There appears to be some drift, where a location will loose the domain, even though the domain view shows the location, the manage locations view does not have the domain in the selected items. If you try to move it over, you get an error that the taxonomy has been violated. If you try to update the location via api calls you get " {‘error’: {‘id’: 7, ‘errors’: {‘name’: , ‘domains’: [‘expecting domains used by hosts or inherited (check mismatches report).’]}, ‘full_messages’: [‘Domains expecting domains used by hosts or inherited (check mismatches report).’]}}"
From the foreman logs:
2020-08-03T20:58:43 [E|app|304fcee7] Unprocessable entity Location (id: 4):
| Domains expecting domains used by hosts or inherited (check mismatches report).
|
The only way I’ve found to fix this is clicking the big green button “Fix Mismatches” But I can’t find a programatic way to execute this from the API. This appears to be only fixable via the UI.
Foreman Version:
1.23.2
If this is fixed in a future version, or the API exposes this functionality that would be great, but I haven’t found any mention of this. We usually don’t realize this is a problem until we try to build a host and it fails due to this mismatch.
Man I wish I knew how to reproduce, it just happens over time and I haven’t found the cause. I only have one organization (the default one) and when I manage the locations and try to move the domain over to the selected list (It’s red in the UI on the left hand box) I see that taxonomy error:
2020-08-04T14:44:09 [W|app|e33687d9] Action failed
| ActiveRecord::RecordInvalid: Validation failed: Taxonomy has already been taken
I can see from the logs that foreman does a POST like:
Started POST “/locations/9-rack504/import_mismatches”
Which fixes up the location and I can get builds going again.
I’ve verified before trying this that the domain has the location already, and both the location and domain are in the same organization. (there is only a single domain). Clicking the fix mismatch resolves the issue as I see the domain listed in the selected items, and grayed background preventing selection in the manage locations view after clicking the Fix Mismatch.
I guess it’s not much of a problem and has an easy fix, just wondering how to do this programmatically instead of relying on the UI.