Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source additional files correctly in elasticsearch-cli #40890

Merged
merged 4 commits into from
Apr 5, 2019

Conversation

jkakavas
Copy link
Member

@jkakavas jkakavas commented Apr 5, 2019

Since we only source additional sources from the same dir as our
cli scripts, resolve the path relevant to $ES_HOME

Resolves: #40889

Since we only source additional sources from the same dir as our
cli scripts, resolve the path relevant to $ES_HOME

Resolves: elastic#40889
@jkakavas jkakavas added >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts v7.0.0 v8.0.0 v7.2.0 v7.0.0-rc2 labels Apr 5, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jkakavas jkakavas requested a review from jasontedor April 5, 2019 09:59
@jkakavas jkakavas changed the title Source additional files correctly in elasticseraach-cli Source additional files correctly in elasticsearch-cli Apr 5, 2019
Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some questions.

@@ -7,7 +7,7 @@ source "`dirname "$0"`"/elasticsearch-env
IFS=';' read -r -a additional_sources <<< "$ES_ADDITIONAL_SOURCES"
for additional_source in "${additional_sources[@]}"
do
source "`dirname "$0"`"/$additional_source
source $ES_HOME/bin/$additional_source
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need quotes here since ES_HOME could have spaces. Can you verify this, and quote if needed.

Also, does Windows have the same problem and need a fix too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does Windows have the same problem and need a fix too?

we use:

if defined ES_ADDITIONAL_SOURCES (
  for %%a in ("%ES_ADDITIONAL_SOURCES:;=","%") do (
    call "%~dp0%%a"
  )
)

%~dp0 will always expand to the full path where the batch file is located and not one relative to where the batch script is executed from, so it will not be affected by the cd that happens when we source elasticsearch-env.bat . That said, I'd have nothing against a manual confirmation, I don't have access to a windows machine right now :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks right to me, thanks for checking.

@jasontedor
Copy link
Member

Can we add a packaging test for this? How about one that from not ES_HOME loops through each tool and tries to invoke help on them? That would fail before this change, and succeed after?

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jkakavas
Copy link
Member Author

jkakavas commented Apr 5, 2019

@elasticmachine run elasticsearch-ci/2 ( we hit the issue that #40658 hopefully addresses)

@jasontedor jasontedor merged commit 4b3c13a into elastic:master Apr 5, 2019
jasontedor pushed a commit that referenced this pull request Apr 5, 2019
Since we only source additional sources from the same dir as our
cli scripts, resolve the path relevant to $ES_HOME
jasontedor pushed a commit that referenced this pull request Apr 5, 2019
Since we only source additional sources from the same dir as our
cli scripts, resolve the path relevant to $ES_HOME
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Apr 6, 2019
* master: (63 commits)
  Suppress lease background sync failures if stopping (elastic#40902)
  [DOCS] Added settings page for ILM. (elastic#40880)
  [Docs] Remove extraneous text (elastic#40914)
  Move test classes to test root in Painless (elastic#40873)
  Fix date index name processor default date_formats (elastic#40915)
  Source additional files correctly in elasticsearch-cli (elastic#40890)
  Allow AVX-512 on JDK 11+ (elastic#40828)
  [Docs] Change example to show col headers (elastic#40822)
  Update apache httpclient to version 4.5.8 (elastic#40875)
  Update monitoring-kibana.json (elastic#40899)
  Introduce Delegating ActionListener Wrappers (elastic#40129)
  Deprecate old transport settings (elastic#40821)
  Add Kibana application privileges for monitoring and ml reserved roles (elastic#40651)
  Use Writeable for TransportReplAction derivatives (elastic#40894)
  Add test for HTTP and Transport TLS on basic license (elastic#40714)
  Remove unneded cluster config from test (elastic#40856)
  Make Fuzziness reject illegal values earlier (elastic#33511)
  Remove test-only customisation from TransReplAct (elastic#40863)
  Fix dense/sparse vector limit documentation (elastic#40852)
  Make -try xlint warning disabled by default. (elastic#40833)
  ...
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Apr 6, 2019
* master: (77 commits)
  Suppress lease background sync failures if stopping (elastic#40902)
  [DOCS] Added settings page for ILM. (elastic#40880)
  [Docs] Remove extraneous text (elastic#40914)
  Move test classes to test root in Painless (elastic#40873)
  Fix date index name processor default date_formats (elastic#40915)
  Source additional files correctly in elasticsearch-cli (elastic#40890)
  Allow AVX-512 on JDK 11+ (elastic#40828)
  [Docs] Change example to show col headers (elastic#40822)
  Update apache httpclient to version 4.5.8 (elastic#40875)
  Update monitoring-kibana.json (elastic#40899)
  Introduce Delegating ActionListener Wrappers (elastic#40129)
  Deprecate old transport settings (elastic#40821)
  Add Kibana application privileges for monitoring and ml reserved roles (elastic#40651)
  Use Writeable for TransportReplAction derivatives (elastic#40894)
  Add test for HTTP and Transport TLS on basic license (elastic#40714)
  Remove unneded cluster config from test (elastic#40856)
  Make Fuzziness reject illegal values earlier (elastic#33511)
  Remove test-only customisation from TransReplAct (elastic#40863)
  Fix dense/sparse vector limit documentation (elastic#40852)
  Make -try xlint warning disabled by default. (elastic#40833)
  ...
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
Since we only source additional sources from the same dir as our
cli scripts, resolve the path relevant to $ES_HOME
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v7.0.0-rc2 v7.0.0 v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI tools in linux only work from within $ES_HOME
5 participants