How to delete an unused "Location" in Red Hat Satellite 6.1

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.1

Issue

  • How to delete an unused "Location" in Red Hat Satellite 6.1
  • Deleting a Location in Red Hat Satellite 6 fails with error
Cannot delete the default Location

Resolution

  • This issue is identified as a bug BZ # 1268012

  • Default Location can be deleted, as long as there is another location available and it is not used in Red Hat Satellite server.

  • Locations in Red Hat Satellite 6.1 can only be deleted if katello_default attribute is set to false.

Root Cause

  • The initial execution of katello-installer command will create a Default Organization and Default Location entities by default. This information is retrieved from the katello answers file /etc/katello-installer/answers.katello-installer.yaml
[root@satellite ~]# grep initial /etc/katello-installer/answers.katello-installer.yaml
initial_organization: Default Organization
initial_location: Default Location
  • In Red Hat Satellite 6.1, during the initial installation correct Organization and Location can be set using the below command
[root@satellite ~]# katello-installer  --foreman-initial-location "Your_Location" --foreman-initial-organization "Your_ORG"
  • If the above options are not set then installer will create a Default Location and Default Organization with katello_default: true attribute set for this location. This can be observed by executing the below foreman-rake command
[root@satellite ~]# foreman-rake console 

irb(main):010:0> Location.all
2015-09-23 21:31:16 [D]   Location Load (0.6ms)  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-09-23 08:07:09", ignore_types: ["ConfigTemplate", "Hostgroup"], description: "", label: nil, apply_info_task_id: nil, ancestry: nil, title: "Default_Location", katello_default: true>, #<Location id: 4, name: "LAB", type: "Location", created_at: "2015-09-02 12:13:08", updated_at: "2015-09-21 15:01:43", ignore_types: ["ConfigTemplate", "Hostgroup"], description: "", label: nil, apply_info_task_id: nil, ancestry: nil, title: "LAB", katello_default: false>]

irb(main):011:0> exit

From the above output, the Default_Location has "katello_default: true", so deleting the Location is not possible.

Diagnostic Steps

  • Confirm whether the correct Organization and Location information is passed during initial installation of Red Hat Satellite 6
[root@satellite ~]# grep initial /etc/katello-installer/answers.katello-installer.yaml
initial_organization: Default Organization
initial_location: Default Location

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.