Project

General

Profile

Bug #2209

JSON output changes when ActiveRecord storeconfigs is in use

Added by Dominic Cleal over 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When Puppet is configured with ActiveRecord-based storeconfigs, this causes the to_json impl from ActiveSupport to get loaded over the 'json' gem implementation.

This causes a different API output for Puppet environments, e.g.

$ curl http://192.168.122.90:8443/puppet/environments
[{"name":"test","paths":["/etc/puppet/modules"]},{"name":"production","paths":["/etc/puppet/modules"]}]

vs the normal:

$ curl -k https://192.168.101.10:8443/puppet/environments
["development","production"]

And then Foreman itself can't understand the data structure when importing classes:

undefined method `values' for []:Array

Associated revisions

Revision 603d0651 (diff)
Added by Dominic Cleal over 6 years ago

fixes #2209 - explicitly use Proxy::Puppet::Environment#name for to_json

History

#1 Updated by Dominic Cleal over 6 years ago

  • Status changed from New to Ready For Testing
  • Target version set to 26

#2 Updated by Dominic Cleal over 6 years ago

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

#3 Updated by Dominic Cleal over 6 years ago

  • Target version changed from 26 to 1.2.0

#4 Updated by Suyash Jain almost 5 years ago

Hi,

I am getting the same issue.

Oops, we're sorry but something went wrong

Warning!
undefined method `values' for []:Array

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 `values' for []:Array
app/services/puppet_class_importer.rb:78:in `new_classes_for'
app/services/puppet_class_importer.rb:39:in `changes'
app/controllers/concerns/foreman/controller/environments.rb:11:in `import_environments'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Regards

Suyash

#5 Updated by Greg Sutcliffe about 1 year ago

  • Target version deleted (1.2.0)

Also available in: Atom PDF