Problem: After upgrading from 2.1.0 to 2.2.3, encountering BMC errors: “undefined method `bmc’ for nil:NilClass”. Editing and attempting to save the interface results in 500 Internal Server Error.
Expected outcome: BMC should be working.
Foreman and Proxy versions: 2.2.3
Foreman and Proxy plugin versions: Foreman Discovery 16.2.0
Distribution and version: CentOS 7.9
Other relevant data:
[root@ ~]# foreman-rake errors:fetch_log request_id=ed9474b0
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Warning: Logging layout is not multiline_request_pattern.
This output of this command can be incomplete.
2021-04-13T17:58:48 [I|app|ed9474b0] Started GET “/hosts/c78087-1qjnd43/bmc” for 127.0.0.1 at 2021-04-13 17:58:48 -0400
2021-04-13T17:58:48 [I|app|ed9474b0] Processing by HostsController#bmc as HTML
2021-04-13T17:58:48 [I|app|ed9474b0] Parameters: {“id”=>“c78087-1qjnd43”}
2021-04-13T17:58:48 [W|app|ed9474b0] undefined method bmc' for nil:NilClass 2021-04-13T17:58:48 [I|app|ed9474b0] Backtrace for 'undefined method
bmc’ for nil:NilClass’ error (NoMethodError): undefined method `bmc’ for nil:NilClass
2021-04-13T17:58:48 [I|app|ed9474b0] Rendering common/500.html.erb
2021-04-13T17:58:48 [I|app|ed9474b0] Rendered common/500.html.erb (Duration: 1.7ms | Allocations: 746)
2021-04-13T17:58:48 [I|app|ed9474b0] Completed 500 Internal Server Error in 19ms (Views: 2.6ms | ActiveRecord: 2.6ms | Allocations: 7276)
Foreman version: 2.2.3
Plugins:
- foreman_discovery 16.2.0
[root@ ~]# foreman-rake errors:fetch_log request_id=7b2e8214
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Warning: Logging layout is not multiline_request_pattern.
This output of this command can be incomplete.
2021-04-13T17:46:34 [I|app|7b2e8214] Started PATCH "/hosts/346" for 127.0.0.1 at 2021-04-13 17:46:34 -0400
2021-04-13T17:46:34 [I|app|7b2e8214] Processing by HostsController#update as */*
2021-04-13T17:46:34 [I|app|7b2e8214] Parameters: {"utf8"=>"✓", "authenticity_token"=>"pgDDJbpGBpkgDMYrvwX6tb82wILx1QTaAkTfXMWqL0/DkDeaR6TLozOhDySoIC6GIkmm1KRrcv110YiA7EdFRQ==", "host"=>{"name"=>"", "hostgroup_id"=>"", "environment_id"=>"1", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "mac"=>"e4:43:4b:de:46:74", "identifier"=>"eno1", "name"=>"c78087-1qjnd43", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"10.133.200.248", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"1", "tag"=>"", "attached_to"=>"", "id"=>"1722"}, "1"=>{"_destroy"=>"0", "mac"=>"e4:43:4b:de:46:75", "identifier"=>"eno2", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "tag"=>"", "attached_to"=>"", "id"=>"1723"}, "2"=>{"_destroy"=>"0", "mac"=>"e4:43:4b:de:46:76", "identifier"=>"eno3", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"0", "primary"=>"0", "provision"=>"0", "tag"=>"", "attached_to"=>"", "id"=>"1724"}, "3"=>{"_destroy"=>"0", "mac"=>"e4:43:4b:de:46:77", "identifier"=>"eno4", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"0", "primary"=>"0", "provision"=>"0", "tag"=>"", "attached_to"=>"", "id"=>"1725"}, "4"=>{"_destroy"=>"1", "mac"=>"f4:02:70:eb:b4:7a", "identifier"=>"ipmi", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"10.133.198.252", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "username"=>"root", "provider"=>"IPMI", "id"=>"1726"}, "1618350365097"=>{"type"=>"Nic::BMC", "mac"=>"", "identifier"=>"ipmi", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"10.133.198.252", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "username"=>"root", "password"=>"[FILTERED]", "provider"=>"IPMI"}}, "architecture_id"=>"3", "operatingsystem_id"=>"2", "medium_id"=>"8", "ptable_id"=>"127", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "host_parameters_attributes"=>{"0"=>{"name"=>"serial-number", "parameter_type"=>"string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"203"}, "1"=>{"name"=>"tag", "parameter_type"=>"string", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "id"=>"16"}}, "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"2", "comment"=>"", "overwrite"=>"false"}, "fakepassword"=>"[FILTERED]", "id"=>"346"}
2021-04-13T17:46:34 [W|app|7b2e8214] Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil: #<Host::Managed id: 346, name: "c78087-1qjnd43", last_compile: nil, last_report: nil, updated_at: "2020-08-28 22:32:58", created_at: "2020-07-24 23:30:45", root_pass: [FILTERED], architecture_id: 3, operatingsystem_id: 2, environment_id: 1, ptable_id: 127, medium_id: 8, build: false, comment: "", disk: "", installed_at: "2020-07-27 21:05:09", model_id: 2, hostgroup_id: nil, owner_id: 4, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 1, certname: nil, image_id: nil, organization_id: 1, location_id: 2, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "$5$NHqtwoMfsqTlBGyY$dopggiuw2RqhMhfkZ00jyMQBiC/mgW...", global_status: 0, lookup_value_matcher: [FILTERED], pxe_loader: "PXELinux BIOS", initiated_at: "2020-07-27 20:54:43", build_errors: nil, discovery_rule_id: nil>
2021-04-13T17:46:34 [I|app|7b2e8214] Backtrace for 'Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil: #<Host::Managed id: 346, name: "c78087-1qjnd43", last_compile: nil, last_report: nil, updated_at: "2020-08-28 22:32:58", created_at: "2020-07-24 23:30:45", root_pass: [FILTERED], architecture_id: 3, operatingsystem_id: 2, environment_id: 1, ptable_id: 127, medium_id: 8, build: false, comment: "", disk: "", installed_at: "2020-07-27 21:05:09", model_id: 2, hostgroup_id: nil, owner_id: 4, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 1, certname: nil, image_id: nil, organization_id: 1, location_id: 2, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "$5$NHqtwoMfsqTlBGyY$dopggiuw2RqhMhfkZ00jyMQBiC/mgW...", global_status: 0, lookup_value_matcher: [FILTERED], pxe_loader: "PXELinux BIOS", initiated_at: "2020-07-27 20:54:43", build_errors: nil, discovery_rule_id: nil>' error (Module::DelegationError): Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil: #<Host::Managed id: 346, name: "c78087-1qjnd43", last_compile: nil, last_report: nil, updated_at: "2020-08-28 22:32:58", created_at: "2020-07-24 23:30:45", root_pass: [FILTERED], architecture_id: 3, operatingsystem_id: 2, environment_id: 1, ptable_id: 127, medium_id: 8, build: false, comment: "", disk: "", installed_at: "2020-07-27 21:05:09", model_id: 2, hostgroup_id: nil, owner_id: 4, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 1, certname: nil, image_id: nil, organization_id: 1, location_id: 2, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "$5$NHqtwoMfsqTlBGyY$dopggiuw2RqhMhfkZ00jyMQBiC/mgW...", global_status: 0, lookup_value_matcher: [FILTERED], pxe_loader: "PXELinux BIOS", initiated_at: "2020-07-27 20:54:43", build_errors: nil, discovery_rule_id: nil>
2021-04-13T17:46:34 [I|app|7b2e8214] Rendering common/500.html.erb
2021-04-13T17:46:34 [I|app|7b2e8214] Rendered common/500.html.erb (Duration: 0.8ms | Allocations: 377)
2021-04-13T17:46:34 [I|app|7b2e8214] Completed 500 Internal Server Error in 26ms (Views: 1.3ms | ActiveRecord: 2.9ms | Allocations: 13541)
Foreman version: 2.2.3
Plugins:
- foreman_discovery 16.2.0