Red Hat Bugzilla – Bug 1268012
Unable to delete Default Location from Satellite 6.1
Last modified: 2017-08-15 15:46:16 EDT
Description of problem:
It is impossible to delete an unused "Default Location" from Satellite 6.1 either through webUI or hammer CLI
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Install fresh Satellite 6.1 without specifying --foreman-initial-location and --foreman-initial-organization parameters, which would create a Default Organization and Default Location
2. Create a new Organization and Location of choice in Satellite webUI
3. Try to delete the old "Default Location" which fails with error "Cannot delete the default Location"
Same result from the hammer CLI as well
hammer> location list
[Foreman] Username: admin
[Foreman] Password for admin:
ID | NAME
2 | Default Location
4 | ACME_Corp
hammer> location delete --id 2
Could not delete the location:
Cannot delete the default Location
Cannot delete the default location
Satellite should allow delete unused locations
# foreman-rake console
Loading production environment (Rails 3.2.8)
2015-10-01 20:15:03 [D] Location Load (0.7ms) SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') ORDER BY title
=> [#<Location id: 2, name: "Default Location", type: "Location", created_at: "2015-08-31 15:13:09", updated_at: "2015-08-31 15:13:09", ignore_types: ["ConfigTemplate", "Hostgroup"], description: nil, label: nil, apply_info_task_id: nil, ancestry: nil, title: "Default Location", katello_default: true>, #<Location id: 4, name: "ACME_Corp", type: "Location", created_at: "2015-09-02 12:13:08", updated_at: "2015-09-21 16:25:28", ignore_types: ["ConfigTemplate", "Hostgroup"], description: "", label: nil, apply_info_task_id: nil, ancestry: nil, title: "ACME_Corp", katello_default: false>]
As from the above rake output if the "katello_default: true" parameter is set for the location, Satellite 6 would not allow to delete it.
*** Bug 1281220 has been marked as a duplicate of this bug. ***
Reset docs contact <> daobrien
Unassigning myself since I'm not actively working on the bug.
Please specify if below procedure in manually changing default location is safe and can be offered to customers as a workaround:
(basically: stop all services to prevent concurrent issues, start psql, manually change katello_default, start everything)
Created redmine issue http://projects.theforeman.org/issues/18226 from this bug
From what I gathered by talking to the devs who wrote the feature that keeps the user from removing the default location, it's a bad idea.
The reason is that the Default Location is used to have a place to put registered hosts via subscription manager, and puppet environments for a content view publish. Without it, those operations will fail.
I am working on a patch that allows the user to set the default location for each of these things in Administer > Settings, which would let you remove the default one provided after the install.
Upstream bug assigned to email@example.com
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18226 has been resolved.
Verified on Satellite 6.3.0 snap 9.
Locations set in "Default Location Puppet content" or "Default Location subscribed hosts" settings can not be deleted. Changing both these settings to a location other then the Default Location allows deletion of the default location.