Project

General

Profile

Actions

Bug #17260

closed

Discovered (7.0) host does not delete with error "undefined method `operatingsystem'"

Added by Rob Leach over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Behavior

Attempting to delete an FDI-added host fails with the error

Oops, we're sorry but something went wrong undefined method `operatingsystem' for #<Host::Discovered:0x00000007c2e190>

Since we had attempted to provision the host once while it was in this state, we now have a record trapped in Discovered hosts that isn't deleting with foreman-rake nicely:

#<Host::Discovered id: 14, name: "esx09.foundry.local", last_compile: nil, last_report: "2016-11-05 22:58:27", updated_at: "2016-11-05 22:58:27", created_at: "2016-10-28 21:34:44", root_pass: "$1$kqhFXEcK$tX6OHPq5EksbuKH1CspSm/", architecture_id: 1, operatingsystem_id: 2, environment_id: nil, ptable_id: 87, medium_id: 9, build: false, comment: "", disk: nil, installed_at: "2016-10-28 21:46:48", model_id: 2, hostgroup_id: 2, owner_id: 8, owner_type: "User", enabled: true, puppet_ca_proxy_id: nil, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: nil, location_id: nil, type: "Host::Discovered", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "$1$kqhFXEcK$tX6OHPq5EksbuKH1CspSm/", global_status: 0, lookup_value_matcher: "fqdn=esx09.foundry.local", pxe_loader: "PXELinux BIOS", discovery_rule_id: nil>

Reproduction steps

Unfortunately, we are unable to reproduce the exact discovery-time behavior that resulted in our broken Discovered host. (Network and service changes were underway, so it could be as simple as administrator-induced error.)

Environment

  • Using Foreman 1.13 with Discovery 7.0 on a CentOS 7 installation. (Used the Foreman Installation Guide as our first steps.)
  • Smart Proxies for DHCP/DNS on a Windows 2012R2 host.
  • iPXE-based (undionly.kpxe, rebuilt to get nextfile direction from a server-side .py) boot into the base FDI image * Image retrieved from: http://downloads.theforeman.org/discovery/releases/3.2/fdi-image-latest.tar * Image retrieved on approximately Oct-27

Partial stack trace

(remainder in attached foreman-tail logfile)

NoMethodError
undefined method `operatingsystem' for #<Host::Discovered:0x00000007c2e190>
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activemodel-4.2.5.1/lib/active_model/attribute_methods.rb:433:in `method_missing'
/usr/share/foreman/app/models/nic/managed.rb:21:in `operatingsystem'
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:19:in `dhcp?'
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:156:in `queue_dhcp_destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:164:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:164:in `block in halting'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `block in call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_destroy_callbacks'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'

Attachments

foreman_tail__Nov-7.log -- ran foreman-tail as root while attempting the UI-based delete


Files

foreman_tail__Nov-7.log foreman_tail__Nov-7.log 132 KB Rob Leach, 11/07/2016 02:32 PM

Related issues 2 (0 open2 closed)

Related to Discovery - Feature #16890: Prevent host discovery for existing MAC/IP addressesClosedLukas Zapletal10/12/2016Actions
Related to Discovery - Bug #18550: Unable to remove discovered host that failed provisioningResolved02/17/2017Actions
Actions

Also available in: Atom PDF