saltstack-formulas / sensu-formula

Salt Stack formula to manage Sensu.
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
23 stars 78 forks source link

Fix default state rendering #39

Closed EvaSDK closed 7 years ago

EvaSDK commented 7 years ago

Current way of providing source and proxy to gem.installed fails like this:

2017-04-03 18:00:19,085 [salt.state       ][INFO    ][3242] Running state [sensu-plugins-disk-checks] at time 18:00:19.085168
2017-04-03 18:00:19,088 [salt.state       ][INFO    ][3242] Executing state gem.installed for sensu-plugins-disk-checks
2017-04-03 18:00:19,091 [salt.loaded.int.module.cmdmod][INFO    ][3242] Executing command ['/opt/sensu/embedded/bin/gem', 'list', 'sensu-plugins-disk-checks'] in directory '/root'
2017-04-03 18:00:21,220 [salt.loaded.int.module.cmdmod][INFO    ][3242] Executing command ['/opt/sensu/embedded/bin/gem', 'install', 'sensu-plugins-disk-checks', '--no-rdoc', '--no-ri', '-p', 'None', '--source', 'None'] in directory '/root'
2017-04-03 18:00:23,573 [salt.loaded.int.module.cmdmod][ERROR   ][3242] Command '['/opt/sensu/embedded/bin/gem', 'install', 'sensu-plugins-disk-checks', '--no-rdoc', '--no-ri', '-p', 'None', '--source', 'None']' failed with return code: 1
2017-04-03 18:00:23,576 [salt.loaded.int.module.cmdmod][ERROR   ][3242] stderr: ERROR:  While executing gem ... (OptionParser::InvalidArgument)
    invalid argument: -p None
2017-04-03 18:00:23,578 [salt.loaded.int.module.cmdmod][ERROR   ][3242] retcode: 1
2017-04-03 18:00:23,582 [salt.state       ][ERROR   ][3242] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1735, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1653, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/states/gem.py", line 108, in installed
    source=source):
  File "/usr/lib/python2.7/dist-packages/salt/modules/gem.py", line 138, in install
    runas=runas)
  File "/usr/lib/python2.7/dist-packages/salt/modules/gem.py", line 66, in _gem
    raise CommandExecutionError(ret['stderr'])
CommandExecutionError: ERROR:  While executing gem ... (OptionParser::InvalidArgument)
    invalid argument: -p None

2017-04-03 18:00:23,588 [salt.state       ][INFO    ][3242] Completed state [sensu-plugins-disk-checks] at time 18:00:23.587710 duration_in_ms=4502.541

This is due to providing None as a default value to pillar.get which is rendered in state as 'None' which is not equivalent to the None value that YAML understands.

snadorp commented 7 years ago

PR's don't seem to get much love here nowadays. @powellchristoph There are 3 PRs addressing the same problem, breaking deployments for environments where no proxies are in place. Can you take a look?

powellchristoph commented 7 years ago

@snadorp I am sorry for the lack of assistance. I am no longer an active contributer but I can help get your PRs in.