Project

General

Profile

Actions

Bug #8782

closed

Missing whitespace in the cmd when using the mco provider for puppetrun

Added by Daniel Gagnon over 9 years ago. Updated almost 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Puppet
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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.

Actions #1

Updated by Daniel Gagnon over 9 years ago

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

Actions #2

Updated by Daniel Gagnon over 9 years ago

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.

Actions #4

Updated by Dominic Cleal about 9 years ago

  • Category changed from Plugins to Puppet
Actions #5

Updated by Corey Osman about 9 years ago

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(' ')}

Actions #6

Updated by Dominic Cleal about 9 years ago

It might be useful to compare Ruby versions too, as I think there are multiple ways the command can get executed.

Actions #7

Updated by Daniel Gagnon almost 8 years ago

unable to replicate on newer version, might have been a ruby or some gem's version.
I think we can close this.

Actions #8

Updated by Dominic Cleal almost 8 years ago

  • Status changed from New to Rejected
Actions

Also available in: Atom PDF