Project

General

Profile

Actions

Bug #17260

closed

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

Added by Rob Leach about 8 years ago. Updated almost 8 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 #1

Updated by Lukas Zapletal about 8 years ago

  • Project changed from Foreman to Discovery
  • Status changed from New to Need more information

Hello,

do this in order to delete the failed record:

h = Host::Discovered.find_by_name("xxxx")
h.update_attributes(:managed => false)
h.destroy
Actions #2

Updated by Rob Leach about 8 years ago

Thanks for the help yesterday, Lukas!

I didn't have a chance to attempt the steps you listed above, but in my naivety to rails, I had attempted the following:

h = Host::Discovered.find_by_name("NAME.AS.LISTED.IN.DISCOVERED")
h.managed = false
h.save!

I was surprised that I somehow had a record that was not valid.
irb(main):012:0* h
=> #<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$kuhFXEcK$tX6OHPq5EksbulH1CspSm/", 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>
irb(main):013:0> h.managed = false
=> false
irb(main):014:0> h.save!

To work around the issue, I used psql in this way:

su - postgres
psql -d foreman

-- Find the ID in the hosts table
--note the ID number
select id, name from hosts where name  = 'NAME.AS.LISTED.IN.DISCOVERED';

-- ||: While we haven't succeeded in deleting from hosts

-- Naive delete attempt
--Note the FK that complains
delete from hosts where id = IDNUM

-- Execute delete on that table
delete from THATTABLE where id = IDNUM

-- end :||
\q
Actions #3

Updated by Eli Landon about 8 years ago

Hi,
I hit a similar exception while trying to delete a discovered host that was discovered using the 1.12 image and plugin prior to upgrading. When I went to delete on 1.13 I got this stack-trace. Same function as above but this is complaining about the compute method.

2016-11-09T12:58:45 cbdcb468 [app] [D] undefined method `compute?' for #<Host::Discovered:0x007fcbc0d9d940> | /usr/share/foreman/vendor/ruby/2.0.0/gems/activemodel-4.2.7.1/lib/active_model/attribute_methods.rb:433:in `method_missing' | /usr/share/foreman/app/models/nic/base.rb:18:in `block in <class:Base>' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:448:in `instance_exec' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:448:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `block (2 levels) in conditional' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `each' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `all?' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `block in conditional' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `block in call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `each' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_validate_callbacks' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activemodel-4.2.7.1/lib/active_model/validations.rb:399:in `run_validations!' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activemodel-4.2.7.1/lib/active_model/validations/callbacks.rb:113:in `block in run_validations!' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:117:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:117:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_validation_callbacks' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activemodel-4.2.7.1/lib/active_model/validations/callbacks.rb:113:in `run_validations!' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activemodel-4.2.7.1/lib/active_model/validations.rb:338:in `valid?' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/validations.rb:58:in `valid?' | /usr/share/foreman/app/models/concerns/orchestration.rb:77:in `valid?' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/validations.rb:83:in `perform_validations' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/validations.rb:37:in `save' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/attribute_methods/dirty.rb:21:in `save' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:286:in `block (2 levels) in save' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:220:in `transaction' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:286:in `block in save' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:301:in `rollback_active_record_state!' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:285:in `save' | /usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in `save_with_type' | /usr/share/foreman/app/models/host/base.rb:405:in `set_interface' | /usr/share/foreman/app/models/host/base.rb:176:in `block in set_interfaces' | /usr/share/foreman/app/models/host/base.rb:173:in `each' | /usr/share/foreman/app/models/host/base.rb:173:in `set_interfaces' | /usr/share/foreman/app/models/host/base.rb:150:in `populate_fields_from_facts' | /usr/share/foreman/vendor/ruby/2.0.0/gems/foreman_discovery-7.0.0/app/models/host/discovered.rb:85:in `populate_fields_from_facts' | /usr/share/foreman/app/models/host/base.rb:127:in `import_facts' | /usr/share/foreman/vendor/ruby/2.0.0/gems/foreman_discovery-7.0.0/app/models/host/discovered.rb:70:in `import_facts' | /usr/share/foreman/vendor/ruby/2.0.0/gems/foreman_discovery-7.0.0/app/models/host/discovered.rb:62:in `import_host' | /usr/share/foreman/vendor/ruby/2.0.0/gems/foreman_discovery-7.0.0/app/controllers/api/v2/discovered_hosts_controller.rb:99:in `facts' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/abstract_controller/base.rb:198:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/rendering.rb:10:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:117:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:117:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/app/controllers/api/v2/base_controller.rb:152:in `disable_json_root' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:432:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `block in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:455:in `public_send' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:455:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `block in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/app/controllers/concerns/application_shared.rb:14:in `set_timezone' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:432:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `block in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:432:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `block in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:455:in `public_send' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:455:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:312:in `block in halting' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:81:in `run_callbacks' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/abstract_controller/callbacks.rb:19:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/rescue.rb:29:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `block in instrument' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `instrument' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/abstract_controller/base.rb:137:in `process' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionview-4.2.7.1/lib/action_view/rendering.rb:30:in `process' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal.rb:196:in `dispatch' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_controller/metal.rb:237:in `block in action' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/routing/route_set.rb:74:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/routing/route_set.rb:74:in `dispatch' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/routing/route_set.rb:43:in `serve' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/routing/mapper.rb:49:in `serve' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/journey/router.rb:43:in `block in serve' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/journey/router.rb:30:in `each' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/journey/router.rb:30:in `serve' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/routing/route_set.rb:817:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/apipie-rails-0.3.7/lib/apipie/static_dispatcher.rb:65:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/apipie-rails-0.3.7/lib/apipie/extractor/recorder.rb:132:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/apipie-rails-0.3.7/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call' | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:9:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/flash.rb:260:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/cookies.rb:560:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/query_cache.rb:36:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:88:in `__run_callbacks__' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_call_callbacks' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:81:in `run_callbacks' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/rack/logger.rb:38:in `call_app' | /usr/share/foreman/vendor/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/rack/logger.rb:22:in `call' | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/request_id.rb:21:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/static.rb:120:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engine.rb:518:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/application.rb:165:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send' | /usr/share/foreman/vendor/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each' | /usr/share/foreman/vendor/ruby/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call' | /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:142:in `accept_and_process_next_request' | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' | /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads' | /usr/share/foreman/vendor/ruby/2.0.0/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `block in create_with_logging_context'

Actions #4

Updated by Eli Landon about 8 years ago

Eli Landon wrote:

Hi,
I hit a similar exception while trying to delete a discovered host that was discovered using the 1.12 image and plugin prior to upgrading. When I went to delete on 1.13 I got this stack-trace. Same function as above but this is complaining about the compute method.

2016-11-09T12:58:45 cbdcb468 [app] [D] undefined method `compute?' for #<Host::Discovered:0x007fcbc0d9d940> | /usr/share/foreman/vendor/ruby/2.0.0/gems/activemodel-4.2.7.1/lib/active_model/attribute_methods.rb:433:in `method_missing' | /usr/share/foreman/app/models/nic/base.rb:18:in `block in <class:Base>' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:448:in `instance_exec' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:448:in `block in make_lambda' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `call' | /usr/share/foreman/vendor/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:181:in `block (2 levels) in conditional'

Actions #5

Updated by Lukas Zapletal about 8 years ago

WORKAROUND:

foreman-rake console

Host::Discovered.update_all(:managed => false)
exit

Then delete the hosts. Please confirm.

Actions #6

Updated by The Foreman Bot about 8 years ago

  • Status changed from Need more information to Ready For Testing
  • Assignee set to Lukas Zapletal
  • Pull request https://github.com/theforeman/foreman_discovery/pull/311 added
Actions #7

Updated by Lukas Zapletal about 8 years ago

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

Updated by Lukas Zapletal almost 8 years ago

  • Related to Feature #16890: Prevent host discovery for existing MAC/IP addresses added
Actions #9

Updated by Lukas Zapletal almost 8 years ago

Experienced this today, when existing (managed) host does exist and it boots into Discovery mode, existing host is "converted" into discovered host, facts are deleted. This was the root cause of this.

Actions #10

Updated by Lukas Zapletal almost 8 years ago

  • Related to Bug #18550: Unable to remove discovered host that failed provisioning added
Actions #11

Updated by Lukas Zapletal almost 8 years ago

The root cause of the corrupt record was fixed in 8.0.1 release (#16890). Workaround (deletes all discovered hosts):

foreman-rake console
  1. Host::Discovered.update_all(:managed => false)
  2. Host::Discovered.destroy_all
  3. exit
Actions

Also available in: Atom PDF