0

So as in the title, whenever I try to "Run Puppet" from Foreman I get the following error in the GUI.

This was all due to, in the beginning a configuration error, where activemq needed to be set up. Once that was determined and set up correctly, I then began getting an ERF12-4252 error, that was corresponding to this error message below in the foreman-proxy logs.

W, [2016-10-02T11:12:17.782288 #1796] WARN -- : Non-null exit code when executing '["/usr/bin/sudo", "-u", "root", "/opt/puppetlabs/bin/mco", "puppet", "runonce", "-I", ""]' E, [2016-10-02T11:12:17.782431 #1796] ERROR -- : Failed puppet run: Check Log files I, [2016-10-02T11:12:17.782622 #1796] INFO -- : x.x.x.x - - [02/Oct/2016:11:12:17 -0400] "POST /puppet/run HTTP/1.1" 500 34 0.0054

I was able to finally figure out where the problem was despite the logs being very vague, by adding a shell to the foreman-proxy user, and attempting to run that exact command from the CLI instead of through the Foreman GUI.

Marking this as solved.

  • Can you set :log_level to DEBUG in /etc/foreman-proxy/settings.yml, restart foreman-proxy, use the Run Puppet button again and provide the log file please? A 404 might suggest that the Puppet feature is failing to start on the smart proxy, so the log from startup should provide more info. – Dominic Cleal Sep 27 '16 at 08:26
  • Hopefully this sheds some light, but to me everything appears to be doing what it is supposed to. The only thing I left out was the certificate info from the logs as I didn't want to make some of the information printed out from that public. No errors regarding the certs though. http://pastebin.com/4SsXxwwR – Linuxbadger Sep 27 '16 at 12:31
  • Here's the paste bin for the logs when "Run Puppet" is attempted from the GUI. http://pastebin.com/nkx63iYy – Linuxbadger Sep 27 '16 at 17:10
  • Do you have sudo rules set up for foreman-proxy? See the command it's trying to execute. – Dominic Cleal Sep 28 '16 at 07:02
  • I do, and I verified the command it is trying to execute works when run on the command line. I also gave foreman-proxy a bash shell, su to foreman-proxy, and ran the command from the command line and it worked. – Linuxbadger Sep 28 '16 at 12:07
  • Doesn't appear that mcollective is ever getting the puppet run command from the foreman-proxy. If I run "mco puppet runonce -I " from the command line as the foreman-proxy user, everything works fine and as expected. If I "Run Puppet" from the foreman GUI I get "Non-null exit code when executing '["/usr/bin/sudo", "-u", "foreman-proxy", "/opt/puppetlabs/bin/mco", "puppet", "runonce", "-I", ""]' then Failed puppet run: Check Log files At this point should I just submit a bug report to foreman? – Linuxbadger Sep 29 '16 at 18:58
  • You should try running exactly the same command with the `sudo -u root /opt/puppetlabs/bin/mco` prefix instead of just `mco`. I notice the command changed in your last comment to sudo to the same user - this will still require sudo rules. There's probably little point in filing a bug against the smart proxy as the failing exit code is external to the smart proxy (probably misconfiguration). – Dominic Cleal Sep 30 '16 at 07:06
  • I did as requested and tried to run the exact command found in the foreman-proxy logs, on the command line and it works flawlessly, however the foreman-proxy still gives me this error when trying to run from the foreman GUI. It very well could be a misconfiguration, but none of the logs are being verbose enough to actually troubleshoot that. Foreman-proxy logs below, as well as command run directly. – Linuxbadger Oct 03 '16 at 12:25
  • This can be closed. I finally found the misconfiguration. The suggested sudoers entry from the quick install documentation didn't work correctly on my system, thus causing the non null return code from /usr/bin/sudo -u root /opt/puppetlabs/bin/mco puppet runonce -I foreman.mattlocal.com. This took a good amount of time to track down and was finally found by adding a shell to the foreman-proxy user, and attempting to run using the command above from that user. Thanks for all the suggestions. I'll mark this as solved and update. – Linuxbadger Oct 03 '16 at 12:34

1 Answers1

0

This was all due to, in the beginning a configuration error, where activemq needed to be set up. Once that was determined and set up correctly, I then began getting an ERF12-4252 error, that was corresponding to this error message below in the foreman-proxy logs.

W, [2016-10-02T11:12:17.782288 #1796] WARN -- : Non-null exit code when executing '["/usr/bin/sudo", "-u", "root", "/opt/puppetlabs/bin/mco", "puppet", "runonce", "-I", ""]' E, [2016-10-02T11:12:17.782431 #1796] ERROR -- : Failed puppet run: Check Log files I, [2016-10-02T11:12:17.782622 #1796] INFO -- : x.x.x.x - - [02/Oct/2016:11:12:17 -0400] "POST /puppet/run HTTP/1.1" 500 34 0.0054

I was able to finally figure out where the problem was despite the logs being very vague, by adding a shell to the foreman-proxy user, and attempting to run that exact command from the CLI instead of through the Foreman GUI.