Project

General

Profile

Actions

Bug #16545

closed

Host node YAML import calls AR finder with incorrect second argument

Added by Dominic Cleal over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Under Rails 5, the Host::Managed#importNode method raises an error when importing a YAML file that contains parameterised classes (as in our unit test):

HostTest::location or organizations are not enabled.test_0013_should import from external nodes output
TypeError: can't quote Hash
    app/models/host/managed.rb:489:in `block in importNode'
    app/models/host/managed.rb:488:in `each'
    app/models/host/managed.rb:488:in `importNode'
    test/unit/host_test.rb:757:in `block (2 levels) in <class:HostTest>' (TypeError)
/usr/local/rvm/gems/ruby-2.3.0@test_develop_pr_core-2/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/quoting.rb:177

On Rails 4, calling Puppetclass.find_by_name(["klass", {:params => foo}]) was just returning the klass and ignoring the second element of the array. Under Rails 5 it raises an error.

The .find_by_name call should only be passed a string with a name.

Note that the classes in an ENC YAML may be either an array or hash, but the unit test only checks the hash format.

Actions #1

Updated by The Foreman Bot over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 189
Actions

Also available in: Atom PDF