Bug #6402

Using "run puppet" feature fails: undefined method `gsub' for #<Array ...>

Added by Jon Skarpeteig about 3 years ago. Updated about 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Dominic Cleal
Category:Puppet integration
Target version:Sprint 26
Difficulty: Bugzilla link:1114639
Found in release: Pull request:https://github.com/theforeman/foreman/pull/1603
Story points-
Velocity based estimate-
Release1.5.2Release relationshipAuto

Description


Warning!
undefined method `gsub' for #<Array:0x00000008e13478>

If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, You would probably need to attach the Full trace and relevant log entries.
NoMethodError
undefined method `gsub' for #<Array:0x00000008e13478>
app/controllers/application_controller.rb:172:in `error'
app/controllers/hosts_controller.rb:193:in `puppetrun'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Log from client:

 puppet-agent[6949]: Forbidden request: foreman(10.0.0.10) access to /run/client.fqdn [save] authenticated  at :54

Related issues

Related to Foreman - Bug #5881: CVE-2014-3491 - XSS from create/update/destroy notificati... Closed 05/22/2014
Related to Foreman - Bug #6903: "<br/>" in text when receiving error while deleting multi... Closed 08/04/2014
Related to Foreman - Bug #2383: Pushing the "Certificates" button on a smart proxy with d... Resolved 04/09/2013
Duplicated by Foreman - Bug #6429: Run Puppet causes Error 500 with message "Warning! undefi... Duplicate 06/28/2014
Duplicated by Foreman - Bug #6351: <br /> seen in UI errors when multiple errors exist on a ... Duplicate 06/24/2014

Associated revisions

Revision b4fbdf57
Added by Dominic Cleal about 3 years ago

fixes #6402 - use standard success/error handlers in UI controllers

History

#1 Updated by Jon Skarpeteig about 3 years ago

Should produce a proper error message instead of crashing

#2 Updated by Dominic Cleal about 3 years ago

  • Related to Bug #5881: CVE-2014-3491 - XSS from create/update/destroy notification boxes added

#3 Updated by Dominic Cleal about 3 years ago

  • Subject changed from Using "run puppet" feature fails to Using "run puppet" feature fails: undefined method `gsub' for #<Array ...>
  • Category set to Puppet integration

#4 Updated by Dominic Cleal about 3 years ago

  • Duplicated by Bug #6429: Run Puppet causes Error 500 with message "Warning! undefined method `gsub' for #<Array:0x000000091b0608>" added

#5 Updated by Bryan Kearney about 3 years ago

  • Bugzilla link set to 1114639

#6 Updated by Brian Rak about 3 years ago

I also saw this when the foreman-proxy service was stopped, and I attempted to retrieve a certificate list.

Backtrace:

NoMethodError
undefined method `gsub' for #<ActiveRecord::RecordNotFound: ActiveRecord::RecordNotFound>
app/controllers/application_controller.rb:172:in `error'
app/controllers/puppetca_controller.rb:17:in `rescue in index'
app/controllers/puppetca_controller.rb:7:in `index'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

#7 Updated by Roderick Day about 3 years ago

I was just seeing this same behavior with Foreman 1.5.1 and Puppet 3.6.2. Solved it by adding the following to my client's auth.conf (/etc/puppet/auth.conf)

  1. Allow puppet kick access
    path /run
    method save
    auth any
    allow *

"run puppet" feature now works a treat.

#8 Updated by Roderick Day about 3 years ago

I should add that in the client log I saw the following:

Tue Jul 15 20:09:29 +0000 2014 Puppet (warning): Denying access: Forbidden request: puppet.example.com(<ip_address>) access to /run/hostname.example.com [save] authenticated at :119
Tue Jul 15 20:09:29 +0000 2014 Puppet (err): Forbidden request: puppet.example.com(<ip_address>) access to /run/hostname.example.com [save] authenticated at :119

#9 Updated by Dominic Cleal about 3 years ago

  • Status changed from New to Assigned
  • Assigned To set to Dominic Cleal
  • Target version set to Sprint 26

#10 Updated by The Foreman Bot about 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1603 added

#11 Updated by Dominic Cleal about 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#12 Updated by Dominic Cleal about 3 years ago

  • Duplicated by Bug #6351: <br /> seen in UI errors when multiple errors exist on a resource added

#13 Updated by Dominic Cleal about 3 years ago

  • Related to Bug #6903: "<br/>" in text when receiving error while deleting multiple hosts added

#14 Updated by Dominic Cleal about 3 years ago

  • Related to Bug #2383: Pushing the "Certificates" button on a smart proxy with disabled PuppetCA throws cryptic ActiveRecord error added

Also available in: Atom PDF