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

improve test of tasks "Ensure any remote plugins defined are present" #95

Closed
roumano opened this issue Jul 5, 2017 · 1 comment
Closed

Comments

@roumano
Copy link
Contributor

roumano commented Jul 5, 2017

Actually, i can't run the role without any plugins on a machine :

ansible-playbook  ... --extra-var='sensu_remote_plugins=""'
TASK [sensu-client : Ensure any remote plugins defined are present] ********************************************************************************************************************
failed: [server] (item=) => {"changed": false, "cmd": "sensu-install -p ", "delta": "0:00:00.153447", "end": "2017-07-05 11:53:58.399445", "failed": true, "item": "", "rc": 1, "start": "2017-07-05 11:53:58.245998", "stderr": "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-install:38:in `cli_options': missing argument: -p (OptionParser::MissingArgument)\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-install:124:in `run'\n\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-install:136:in `<top (required)>'\n\tfrom /opt/sensu/embedded/bin/sensu-install:22:in `load'\n\tfrom /opt/sensu/embedded/bin/sensu-install:22:in `<main>'", "stderr_lines": ["/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-install:38:in `cli_options': missing argument: -p (OptionParser::MissingArgument)", "\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-install:124:in `run'", "\tfrom /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-install:136:in `<top (required)>'", "\tfrom /opt/sensu/embedded/bin/sensu-install:22:in `load'", "\tfrom /opt/sensu/embedded/bin/sensu-install:22:in `<main>'"], "stdout": "", "stdout_lines": []}

the when condition should be changed from

when: sensu_remote_plugins > 0

To :

when: sensu_remote_plugins

So we will get a skipping tasks :

TASK [sensu-client : Ensure any remote plugins defined are present] ********************************************************************************************************************
skipping: [server] => (item=) 
@smuth4
Copy link
Contributor

smuth4 commented Jul 8, 2017

sensu_remote_plugins expected to be a list (which defaults to being empty), if you override it to be an empty string python will return that "" > 0 is indeed true (gargbage in, garbage out). If when: sensu_remote_plugins works in both situations, I wouldn't mind a PR, but I don't see the need to fix what's not broken.

@smuth4 smuth4 closed this as completed Jul 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants