Project

General

Profile

Actions

Bug #1549

closed

Triggering 'Run puppet' from GUI returns 500 error

Added by Povilas Daukintis about 12 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Low
Assignee:
Sam Kottler
Category:
Puppet integration
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hello,

I am using following foreman and foreman-proxy versions:

foreman: pre-0.5 (last git commit: dda8e2b951d52a5bfff13317f0b34a9a3c479574)
foreman-proxy: last git commit (aa0a791aa817b0a6a911fa3abe3341a3967dd698)

When triggering 'Run puppet' from Foreman GUI, 'failed to execute puppetrun: 500 Internal Server Error' message is returned, but Puppet agent is triggered successfully on node.

Foreman-proxy configuration was done according this documentation:

http://theforeman.org/projects/smart-proxy/wiki/Settingsyml

Snippet from foreman-proxy.log after triggering 'Run puppet':

E, [2012-03-26T09:29:22.954497 #24332] ERROR -- : Failed puppet run: Check Log files

You can find foreman and foreman-proxy configuration files attached to this ticket.

This bug is low priority and not a show stopper, but it might confuse Foreman GUI users.


Files

foreman_proxy_settings.yaml foreman_proxy_settings.yaml 415 Bytes Foreman proxy settings file Povilas Daukintis, 03/26/2012 02:46 AM
foreman_settings.yaml foreman_settings.yaml 81 Bytes Foreman settings file Povilas Daukintis, 03/26/2012 02:46 AM
puppetrb.patch puppetrb.patch 665 Bytes Povilas Daukintis, 04/04/2012 09:37 AM
Actions #1

Updated by Ohad Levy almost 12 years ago

  • Status changed from New to Feedback
  • Assignee deleted (Ohad Levy)
  • Target version deleted (1.0)

is sudo configured correctly? including the tty bits?

Actions #2

Updated by Povilas Daukintis almost 12 years ago

Ohad Levy wrote:

is sudo configured correctly? including the tty bits?

Yes, /etc/sudoers file contains these items:

foreman-proxy ALL = NOPASSWD: /usr/sbin/puppetrun
foreman-proxy ALL = NOPASSWD: /usr/bin/puppet
Defaults:foreman-proxy !requiretty

I can successfully trigger puppet run as foreman-proxy user via shell:

$ whoami
foreman-proxy
$ /usr/bin/sudo -S /usr/sbin/puppetrun --host virt2
Triggering virt2
Getting status
status is success
virt2 finished with exit code 0
Finished

Also, when triggering puppet run via Foreman's GUI 'Run puppet' I can see that command is executed on foreman host:

Apr  4 16:11:40 bootstraper sudo: foreman-proxy : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/puppetrun --host virt2

Also, Puppet agent is triggered on client node:

Apr  4 16:11:41 virt2 puppet-agent[11061]: triggered run
Apr  4 16:11:45 virt2 puppet-agent[11061]: Finished catalog run in 2.01 seconds

But despite that, foreman-proxy still logs error and returns 500 error:

E, [2012-04-04T16:11:41.965285 #21956] ERROR -- : Failed puppet run: Check Log files

foreman-proxy is running with debug log level enabled but no more useful information is logged.

Actions #3

Updated by Povilas Daukintis almost 12 years ago

I have spent some more time digging around, and it seems that condition in lib/proxy/puppet.rb is never met:

unless command =~ /finished with exit code 0/

I have changed code a little bit, to check for exit code, and everything is working again.

I have attached a patch to this ticket as a attachment.

Actions #4

Updated by Povilas Daukintis almost 12 years ago

Povilas Daukintis wrote:

I have spent some more time digging around, and it seems that condition in lib/proxy/puppet.rb is never met:

[...]

I have changed code a little bit, to check for exit code, and everything is working again.

I have attached a patch to this ticket as a attachment.

Forgot to mention that these changes were applied to foreman-proxy codebase.

Actions #5

Updated by Greg Sutcliffe over 11 years ago

  • Target version set to Bug scrub
Actions #6

Updated by Sam Kottler over 11 years ago

  • Assignee set to Sam Kottler

I'm working on this now. Thanks for the patch @Povilas!

Actions #7

Updated by Benjamin Papillon almost 11 years ago

  • Status changed from Feedback to Closed

We are checking the return code now, so this ticket can be closed.
Thanks for reporting!

Actions

Also available in: Atom PDF