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
Plugin script: Fix ES_HOME with spaces #12508
Conversation
When ES_HOME has spaces we get funky "cannot find main class directory>" errors. This makes them stop by escaping directories and using eval instead of exec. Closes elastic#12504
I'm not sure if this is 1.7.2 or 1.7.1. |
@tlrx @spinscale could you guys review this? thanks! |
I tested this out in a directory with spaces and this fixes the issue described in the ticket. If we also have a space in one of the parameters like the plugin URL we still have an issue in that the parameter is split into two by the space.
It will try to install The fix is similar to what's already been done here and it would be awesome to get it included now:
@nik9000 what do you think? If you'd prefer to keep it separate, we can and I can open up a different PR. |
It makes sense to me. This isn't really my area of expertise but I'm happy to add it. BTW, this is against the 1.7 branch and I'm not sure that this is still an issue in 2.0. Is this another one of things we should just wait on 2.0 to fix? |
I also tested with 2.0 and it is still an issue there as well, so we definitely need to fix it in master. |
Cool. In that case I'll grab this issue in a bit and fix the spaces in On Thu, Jul 30, 2015 at 10:17 AM, Jay Modi notifications@github.com wrote:
|
Swap review for WIP because I have to add another fix and some bats tests. |
@tlrx do you have any special setup that you do to run bats? The bats stuff in 1.7 claims to be very destructive to you system so I spun up an ubuntu vm to test it in. |
Also add some bats tests
Ok - ready for review I think. |
|
||
# Checks that the plugin is correctly removed | ||
assert_file_not_exist "$ES_DIR/bin/shield" | ||
assert_file_exist "$ES_DIR/config/shield" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ES_DIR/config
is intentionally not removed? might be worth a comment in the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly? I have no idea - this is the same checks that are done when the installation directory doesn't have a space. I'd love there to be some method call for this but the other tests seemed to prefer copy and paste over a refactor and I was afraid to do it - especially as I'll have to forward port this to 1.7 and my bash-foo is weak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"I just copy and pasted like the last guy" <--- its a poor defense but in this case I'm sticking to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ES_DIR/config is intentionally not removed? might be worth a comment in the test
Configuration is not removed when removing a plugin. I think elasticsearch configuration is removed when purging the package.
LGTM. Built and ran it in a directory with spaces and used a path with spaces as well. |
Yeah, always use a vm to run the tests! They install/remove packages, user and dirs. See https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc#testing-scripts |
LGTM BATS tests succeed on Debian 7.8, Debian 8, CentOS 6.6, CentOS 7, Ubuntu 12.04 and Ubuntu 15.04 |
LGTM. ready to merge i think. |
That is a good list. |
Plugin script: Fix ES_HOME and plugin directory with spaces
When ES_HOME has spaces we get funky "cannot find main class directory>"
errors. This makes them stop by escaping directories and using eval instead
of exec.
Closes #12504