Bug #32876
openRemoving installation media from operating system doesn't remove installation media - hostgroup relation in database.
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1851939
Description of problem:
Removing custom installation media from the operating system doesn't remove installation media - hostgroup relation in the database causing issues.
For Customer Environment Got Error:
~~~
In the create host view, all entries were selected correctly, I could select "Media Selection" "Synced Content" there and got as "Synced Content" only "Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_8" in the dropdown.
When pressing submit:
"must belong to host's operating system and DLZ-IT/Library/Red_Hat_Server/Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_6 does not belong to RedHat 7.8 operating system" even though I selected ....7_8 instead of ....7_6 as stated in the error message.
~~~
On test system: (tested using RHEL7.8 kickstart repository "published_url" as custom installation media)
After removing install media from OS, Hostgroup inWebUI had Blank "install media". Associated "another install media". But foreman-rake shows "Nil".
~~~
irb(main):004:0> Hostgroup.all.pluck(:name,:id)
=> "hostgroup1", 2], ["hostgroup_centos", 3
irb(main):005:0> h = Hostgroup.find_by_id('2')
=> #<Hostgroup id: 2, name: "hostgroup1", created_at: "2020-06-28 15:28:43", updated_at: "2020-06-29 13:01:30", environment_id: nil, operatingsystem_id: 1, architecture_id: 1, medium_id: nil, ptable_id: 106, root_pass: xxxxx, puppet_ca_proxy_id: nil, use_image: nil, image_file: nil, ancestry: nil, vm_defaults: nil, subnet_id: 3, domain_id: 1, puppet_proxy_id: nil, title: "hostgroup1", realm_id: nil, compute_profile_id: 4, content_source_id: 1, grub_pass: xxxxx, content_view_id: 1, lifecycle_environment_id: 1, lookup_value_matcher: "hostgroup=hostgroup1", kickstart_repository_id: 4, subnet6_id: nil, pxe_loader: "PXELinux BIOS", description: "hostgroup1", compute_resource_id: 1, openscap_proxy_id: nil>
irb(main):006:0> h.medium
=> nil
irb(main):007:0> h.medium
=> nil
~~~
Version-Release number of selected component (if applicable):
How reproducible:
Reproducible
Steps to Reproduce:
1. Content > Products > RHEL > any synced kickstart repo > copy published URL(http://satellite.example.com/pulp/repos/MyOrg1/Library/content/dist/rhel/server/7/7.8/x86_64/kickstart/)
2. Create custom installation media using the above published_at URL. and associate it with RHEL7.8 Hosts > Operating System
3. Create Hostgroup1 > Associate it with Above Operating System and Installation Media >> Provision one Host.
4. Disassociate > Installation media from Operating system
5. WebUI Configure > Hostgroups > Hostgroup1 > Operating System Won't show installation Media. But it's still connected/associated in DB.
~~~- foreman-rake console
Hostgroup.all.pluck(:name,:id) // Look for the ID of the hostgroup in question
h = Hostgroup.find_by_id('X') // Replace X with the ID of the hostgroup
h.medium
~~~
Example:
~~
=> #<Medium id: 10, name: "rhel78", path: "http://satellite.example.com/pulp/repos/MyOrg1/Lib...", created_at: "2020-06-29 12:13:18", updated_at: "2020-06-29 12:13:18", media_path: "", config_path: "", image_path: "", os_family: "Redhat">
irb(main):004:0>
~~
Actual results:
WebUI Shows Hostroups not associated with Media. But in DB it is.
Expected results:
Fail/Show dependencies while disassociating operating systems/host groups/installation Media etc..
Need validation before removal.
Additional info:
Updated by Ondřej Ezr almost 3 years ago
- Related to Bug #32874: Host group operating system media is not properly inherited from parent added