Bug #3151
closedUnable to edit hosts belonging to certain hostgroups: "Host Not Found" . - Missing line in "taxable_taxonomies"
Description
A new hostgroup "MC/app" have been added in the foreman UI.
After clicking on the "Host" tab, then on a host using that group, you get directed to the "Host Not Found" error page.
The debug log says Could'nt find all Hostgroups...:
not found: Couldn't find all Hostgroups with IDs (1, 14, 15, 16, 17) [WHERE (1=1) AND (hostgroups.id in (SELECT taxable_id from taxable_taxonomies WHERE taxable_type = 'Hostgroup' AND taxonomy_id in (1) ) ) AND (hostgroups.id in (SELECT taxable_id from taxable_taxonomies WHERE taxable_type = 'Hostgroup' AND taxonomy_id in (2) ) )] (found 4 results, but was looking for 5)
foreman=# select id,label from hostgroups where id in (1,14,15,16,17); id | label ----+------------------------------------ 1 | MC 14 | MC/app 15 | MC/app/RHEL 16 | MC/app/RHEL/JBoss 17 | MC/app/RHEL/JBoss/GEE (5 rows)
The taxable_taxonomies looks like this for these groups:
foreman=# select * from taxable_taxonomies where taxable_id in (1,14,15,16,17) and taxable_type = 'Hostgroup'; id | taxonomy_id | taxable_id | taxable_type | created_at | updated_at ----+-------------+------------+--------------+----------------------------+---------------------------- 11 | 1 | 1 | Hostgroup | 2013-09-03 13:16:58.558447 | 2013-09-03 13:16:58.558447 12 | 2 | 1 | Hostgroup | 2013-09-03 13:16:58.56759 | 2013-09-03 13:16:58.56759 66 | 1 | 14 | Hostgroup | 2013-09-16 13:30:29.393051 | 2013-09-16 13:30:29.393051 67 | 1 | 15 | Hostgroup | 2013-09-16 13:49:56.167765 | 2013-09-16 13:49:56.167765 68 | 2 | 15 | Hostgroup | 2013-09-16 13:49:56.172548 | 2013-09-16 13:49:56.172548 69 | 1 | 16 | Hostgroup | 2013-09-16 13:54:15.567427 | 2013-09-16 13:54:15.567427 70 | 2 | 16 | Hostgroup | 2013-09-16 13:54:15.576539 | 2013-09-16 13:54:15.576539 71 | 1 | 17 | Hostgroup | 2013-09-17 08:34:33.382524 | 2013-09-17 08:34:33.382524 72 | 2 | 17 | Hostgroup | 2013-09-17 08:34:33.394285 | 2013-09-17 08:34:33.394285
It looks like there should be two lines for "taxable_id" 14, but the one with "taxonomy_id" 2 is missing...
After manually inserting to the table, the host view works.
foreman=# insert into taxable_taxonomies (taxonomy_id, taxable_id, taxable_type, created_at, updated_at) VALUES (2, 14, 'Hostgroup', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); INSERT 0 1
So the question then is how that line ended up missing in the first place.
The "MC/app" hostgroup have been added and removed several times so I figure that an interrupted removal/adding of the hostgroup may have left a database job incomplete or something like that, because all other new host groups I've added have worked as expected.
Updated by Dominic Cleal over 10 years ago
- Category changed from Database to Organizations and Locations
Updated by Leos Stejskal about 3 years ago
- Status changed from New to Closed
I'm closing the issue,
it have been here for some time and I wasn't able to reproduce it on the latest version.
If you think that the issue is still relevant feel free to reopen it.