Bug 907242 - distro importing process ignores osversion alias
Summary: distro importing process ignores osversion alias
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: scheduler
Version: 0.11
Hardware: All
OS: All
high
high
Target Milestone: 0.14
Assignee: Amit Saha
QA Contact: wangjing
URL:
Whiteboard: DistroManagement
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-03 23:19 UTC by Dan Callaghan
Modified: 2018-02-06 00:41 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-09 03:23:55 UTC
Embargoed:


Attachments (Terms of Use)

Description Dan Callaghan 2013-02-03 23:19:37 UTC
If Beaker has an OS version "RedHatEnterpriseLinux6" with an alias "RHEL6", it is possible to import a distro with OS version "RHEL6" and it will create a new, unrelated row in the osversion table. That will then confuse other pieces of code, such as task importing, because there are now essentially two matching rows for "RHEL6".

The distro import process should pay attention to the osversion alias column, and either:
* refuse to import the distro if its OS version matches an existing alias; or
* automatically map the OS version to its "proper" name through the alias

Comment 1 Jeff Burke 2013-02-12 18:56:29 UTC
Do we know when this will be addressed? Currently this blocks any RHEL6 test updates. Also we run the risk of test being silently excluded from KT1.

Thanks,
Jeff

Comment 2 Min Shin 2013-02-13 03:47:15 UTC
(In reply to comment #1)
> Do we know when this will be addressed? Currently this blocks any RHEL6 test
> updates. Also we run the risk of test being silently excluded from KT1.
> 
> Thanks,
> Jeff

Jeff, I propose it for 1.1.

Comment 5 Nick Coghlan 2013-06-21 02:23:18 UTC
This turned out to be a little more intrusive than I'm comfortable with for a maintenance release, so bumping to 0.14. The fact that it is a change designed to prevent future mistakes rather than to fix a current problem makes the conservative approach the better option here :)

Comment 6 Nick Coghlan 2013-06-21 07:19:09 UTC
Dan's original report suggested two alternative behaviours, and we didn't say which we're going to do.

As per the discussion in Gerrit, distros should *always* report their real name in their metadata. If they report an alias instead, then there's something wrong with the metadata and refusing to import the tree is a valid response (only viable distros should be imported and bad metadata = not viable).

Accordingly, importing a distro under an alias will always fail, but the error message will indicate what the real name was expected to be. That should help users figure out the appropriate response for themselves (whether that's abandoning the distro build as broken, regenerating the metadata or going into the Beaker UI and removing the existing alias)

Comment 7 wangjing 2013-06-24 03:14:51 UTC
(In reply to Nick Coghlan from comment #6)
> Dan's original report suggested two alternative behaviours, and we didn't
> say which we're going to do.
> 
> As per the discussion in Gerrit, distros should *always* report their real
> name in their metadata. If they report an alias instead, then there's
> something wrong with the metadata and refusing to import the tree is a valid
> response (only viable distros should be imported and bad metadata = not
> viable).
> 
> Accordingly, importing a distro under an alias will always fail, but the
> error message will indicate what the real name was expected to be. That
> should help users figure out the appropriate response for themselves
> (whether that's abandoning the distro build as broken, regenerating the
> metadata or going into the Beaker UI and removing the existing alias)

ok, i.e. we choose this one:
* refuse to import the distro if its OS version matches an existing alias;

and my comprehension is:
importing a distro by Specifying an existed alias as family will always fail, refuse to import and return error message indicating what the real name was expected to be.

Comment 8 Nick Coghlan 2013-06-24 03:22:02 UTC
Yes, that's the plan. It should start working that way in 0.14 (in 0.13 the answer is still "Don't do that, it may break things")

Comment 11 Amit Saha 2013-07-18 03:33:29 UTC
Patch: http://gerrit.beaker-project.org/#/c/2097/

Comment 14 Dan Callaghan 2013-08-09 03:23:55 UTC
Beaker 0.14.1 has been released.

Comment 15 Nick Coghlan 2013-10-17 06:16:54 UTC
For anyone attempting to clean up a previous bad import from a pre-0.14 release.

If the distro has never been provisioned, it can be purged using the following SQL:

DELETE FROM osversion USING osversion
INNER JOIN osmajor ON osversion.osmajor_id = osmajor.id
WHERE osmajor.osmajor = 'RHEL6';
DELETE FROM osversion_arch_map USING osversion_arch_map
INNER JOIN osversion ON osversion_arch_map.osversion_id = osversion.id
INNER JOIN osmajor ON osversion.osmajor_id = osmajor.id
WHERE osmajor.osmajor = 'RHEL6';
DELETE FROM exclude_osmajor USING exclude_osmajor
INNER JOIN osmajor ON exclude_osmajor.osmajor_id = osmajor.id
WHERE osmajor.osmajor = 'RHEL6';
DELETE FROM osmajor WHERE osmajor = 'RHEL6';

If it has been provisioned, cleaning out the activity history is rather complicated, so it's easier to just rename it to something relatively innocuous:

update osmajor set osmajor = 'BadRHEL6Import' where osmajor = 'RHEL6';


Note You need to log in before you can comment on or make changes to this bug.