Bug #9488

Unable delete the discovered hosts from foreman

Added by Anil Vatti almost 3 years ago. Updated over 2 years ago.

Status:Closed
Priority:Urgent
Assigned To:Ori Rabin
Category:Discovery plugin
Target version:Plugin 2.0.1
Difficulty: Pull request:https://github.com/theforeman/foreman_discovery/pull/168
Bugzilla link:
Story points-
Velocity based estimate-

Description

Hi,

I am unable delete the discovered hosts from foreman, when I attempt to do it, I am getting following error. I have also ensured environment set to non discover (production) and cancelled any build in progress.

Warning!

ERROR: update or delete on table "hosts" violates foreign key constraint "discovery_attribute_sets_host_id_fk" on table "discovery_attribute_sets" DETAIL: Key (id)=(2) is still referenced from table "discovery_attribute_sets".

Installed foreman-version:
foreman-1.7.2-1.el6.noarch
ruby193-rubygem-foreman_discovery-2.0.0-0.1.rc2.el6.noarch

Any help appreciated.

Thanks
Anil


Related issues

Related to Discovery - Refactor #9546: Discovery should provide a convinient method to convert d... Closed 02/25/2015

Associated revisions

Revision 1bc77ee8
Added by Ori Rabin over 2 years ago

Fixes #9488 - migration to delete discovery_attribute_set from managed hosts

History

#1 Updated by Dominic Cleal almost 3 years ago

  • Project changed from Foreman to Discovery

#2 Updated by Anil Vatti almost 3 years ago

By the way this is a brand new install and I have tried multiple times installing from scratch and it still errors out same way. Any further help appreciated.

production.log shows following:

Started POST "/hosts/submit_multiple_destroy?host_ids%5B%5D=4&host_ids%5B%5D=3" for 10.33.6.109 at 2015-02-23 15:11:19 +0000
Processing by HostsController#submit_multiple_destroy as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"tYacd6J525A45OaKMxhCivSxVFJShGHu8z6HD1aPhYY=", "host_ids"=>["4", "3"]}
Operation FAILED: ERROR: update or delete on table "hosts" violates foreign key constraint "discovery_attribute_sets_host_id_fk" on table "discovery_attribute_sets"
DETAIL: Key (id)=(3) is still referenced from table "discovery_attribute_sets".

Rendered common/500.html.erb within layouts/application (4.8ms)
Rendered layouts/base.html.erb (1.2ms)
Completed 500 Internal Server Error in 63ms (Views: 13.0ms | ActiveRecord: 8.8ms)

Web console, trace shows following:

PGError
ERROR: update or delete on table "hosts" violates foreign key constraint "discovery_attribute_sets_host_id_fk" on table "discovery_attribute_sets" DETAIL: Key (id)=(3) is still referenced from table "discovery_attribute_sets".
app/controllers/hosts_controller.rb:431:in `block in submit_multiple_destroy'
app/controllers/hosts_controller.rb:431:in `submit_multiple_destroy'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

#3 Updated by Ori Rabin almost 3 years ago

  • Status changed from New to Assigned
  • Assigned To set to Ori Rabin

#4 Updated by Anil Vatti almost 3 years ago

Another additional information on this.

We have staypuft plugin installed and once we have assigned the discovered systems to openstack controller or compute nodes and deploy them, then foreman is not allowing to delete those hosts.

We have even tried by unassign the hosts from openstack deployment and results is same.

#5 Updated by Ori Rabin over 2 years ago

  • Related to Refactor #9546: Discovery should provide a convinient method to convert discovered host into managed host (aka provision) added

#6 Updated by Ori Rabin over 2 years ago

  • Status changed from Assigned to New
  • Assigned To deleted (Ori Rabin)

This should be fixed after #9546 is merged and a change is made to staypuft to use the new code.

#7 Updated by Lukas Zapletal over 2 years ago

  • Subject changed from unable delete the discovered hosts from foreman to Unable delete the discovered hosts from foreman
  • Category set to Discovery plugin
  • Assigned To set to Ori Rabin
  • Target version set to Plugin 2.0.1

#8 Updated by Lukas Zapletal over 2 years ago

  • Priority changed from Normal to Urgent

#9 Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_discovery/pull/168 added

#10 Updated by Ori Rabin over 2 years ago

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

#11 Updated by Lukas Zapletal over 2 years ago

  • Duplicates Bug #9777: Trying to delete a discovered host after a failed provisioning request fails added

#12 Updated by Lukas Zapletal over 2 years ago

  • Duplicates deleted (Bug #9777: Trying to delete a discovered host after a failed provisioning request fails)

Also available in: Atom PDF