Commit 6ba2bdc2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Disallow variants for OSes that don't support them



Otherwise we get no variant checks at all, but the variant is still
recorded.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 732052c1
......@@ -1097,9 +1097,13 @@ def _CheckOSVariant(os_obj, name):
@param name: OS name passed by the user, to check for validity
"""
variant = objects.OS.GetVariant(name)
if not os_obj.supported_variants:
if variant:
raise errors.OpPrereqError("OS '%s' doesn't support variants ('%s'"
" passed)" % (os_obj.name, variant),
errors.ECODE_INVAL)
return
variant = objects.OS.GetVariant(name)
if not variant:
raise errors.OpPrereqError("OS name must include a variant",
errors.ECODE_INVAL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment