Bug #2347

Installation media in host may be lying.

Added by Jaroslav Henner about 6 years ago. Updated about 6 years ago.

Target version:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:


Have an installation media (IM1) assigned to OS
Create hosts using the OS and IM1
Add another IM (IM2)
Disassociate the IM1 from the OS, so only IM2 remains
Observe hosts that were using IM1. Now they appear to use IM2, which is not true.


#1 Updated by Greg Sutcliffe about 6 years ago

  • Status changed from New to Feedback

Can you clarify where you are looking? Is it just the templates associated with the host?

If so, then the situation you describe is correct - the templates display the data the host will use next time it is rebuilt. It does not necessarily display realtime data about current installation sources. If you want to see that, I'd suggest writing a custom fact.

#2 Updated by Jaroslav Henner about 6 years ago

Templates? I didn't say anything about any template, where did you get this term? It is "installation media" even in the DB. Anyway, I think you understood.

#3 Updated by Greg Sutcliffe about 6 years ago

Ok, to reference the original ticket, you said "Observe Hosts that were using IM1" - what page are you observing?

#4 Updated by Jaroslav Henner about 6 years ago

https://FOREMAN/hosts/XXX/edit, the OperatingSystem tab.

#5 Updated by Greg Sutcliffe about 6 years ago

Ah right, I see. Interesting point. Are you allowed to save the host again with the now-invalid media?

#6 Updated by Ohad Levy about 6 years ago

if I understand this right, this happens when the relationship between the dropdowns changes, for example:

lets say you have a RHEL6.3 OS with Media Mirror defined.
when you upgrade to 6.4 a new OS object is created, where the Mirror media is not associated.

when editing the host, the media mirror is no longer allowed (even if its still in the db) as its related to the current os, and when you click on save, its the only time that you actually change the value.

#7 Updated by Jaroslav Henner about 6 years ago

@Greg: Yes, I am.
@Ohad: Let me try to be more clear.

By dissociating the IM1 from OS, the current media-host association doesn't change in the DB. This means that When I want to completely delete the media, I will not be allowed, there will be errors like "Cannot do that, host blah is using medium IM1.". That's quite OK.

But I IIRC it also means that if I click BUILD now, the host will get built from the old media IM1, not from the IM2 which is shown on the hosts page.

Following the description in the very first commit, I have state:

[root@puppet ~]# psql foreman foreman <<< 'select id, name from media';
 id |         name         
 15 | IM1
 16 | IM2
(12 rows)

We don't have the IM1 associated with the selected OS (of id 8):

[root@puppet ~]# psql foreman foreman <<< 'select * from media_operatingsystems where operatingsystem_id = 8'
 medium_id | operatingsystem_id 
        16 |                  8

Now check what will (IIRC) be used when clicked on BUILD:

[root@puppet ~]# psql foreman foreman <<< 'SELECT,,, as mn FROM hosts JOIN media ON (hosts.medium_id =;'  
 id  |                         name                         | id |         mn         
 127 |                                   | 15 | IM1

But in the Operating System, it looks like the media IM2 would be used, as it is the only media associated with the OS

Also available in: Atom PDF