Bug #8782
closed
Missing whitespace in the cmd when using the mco provider for puppetrun
Added by Daniel Gagnon over 10 years ago.
Updated almost 9 years ago.
Description
How to reproduce:
1. install latest stable ( 1.7.1 )
2. add a host
3. Setup mco ( mco works from the cli )
4. enable puppet run through mco
5. Run puppet from the host page in foreman
Expected Result:
1. puppet should run on the host
Actual Result:
1. 500 error is returned with ERF12-4252
2. http://pastebin.com/f917Pvjx is found in the log
will try to fix it and submit a PR, but getting hung on String into Array and Array to String conversions.
This lines makes the output ok in the logs, but still doesnt work:
Modify:
cmd.push(which("sudo"))
cmd.push("-u", Proxy::Puppet::Plugin.settings.puppet_user)
shell_command(cmd + ["puppet", "runonce", "-I"] + shell_escaped_nodes)
to
cmd.push(which("sudo"), " ")
cmd.push("-u", Proxy::Puppet::Plugin.settings.puppet_user, " ")
shell_command(cmd + [" ", "puppet", " ", "runonce", " ", "-I", " "] + shell_escaped_nodes)
Result:
http://pastebin.com/6t2fkyye
To work with the modifications, I had to modify the foreman-proxy sudoers file. I tried to revert to the original mcollective.rb, but kept the sudoers file, and this worked.
So, the real issues are these:
1. Whitespace mangling in the log make it look like the command is wrong ( see original pastebin ).
2. An entry has to be added to the foreman-proxy sudoers file OR remove the sudo.
- Category changed from Plugins to Puppet
I don't see this happening. I have been using this mco feature since 1.6.3 of smart-proxy and now on 1.7.2. The only thing I do notice is that the log message doesn't contain the necessary spaces. But that is just a log message. I think the real problem is mcollective is throwing an error. I suspect this error to be that your already running puppet and it can't run it while its already running.
logger.warn("Non-null exit code when executing '#{cmd}'") if $?.exitstatus != 0 # this should be #{cmd.join(' ')}
It might be useful to compare Ruby versions too, as I think there are multiple ways the command can get executed.
unable to replicate on newer version, might have been a ruby or some gem's version.
I think we can close this.
- Status changed from New to Rejected
Also available in: Atom
PDF