Commit 07150497 authored by Guido Trotter's avatar Guido Trotter
Browse files

cli.CalculateOSNames



Given an os and its variants, return a list of "full" os names.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 1e288a26
......@@ -158,6 +158,7 @@ __all__ = [
"OPT_COMPL_ONE_OS",
"cli_option",
"SplitNodeOption",
"CalculateOSNames",
]
NO_PREFIX = "no_"
......@@ -971,6 +972,23 @@ def SplitNodeOption(value):
return (value, None)
def CalculateOSNames(os_name, os_variants):
"""Calculates all the names an OS can be called, according to its variants.
@type os_name: string
@param os_name: base name of the os
@type os_variants: list or None
@param os_variants: list of supported variants
@rtype: list
@return: list of valid names
"""
if os_variants:
return ['%s+%s' % (os_name, v) for v in os_variants]
else:
return [os_name]
def UsesRPC(fn):
def wrapper(*args, **kwargs):
rpc.Init()
......
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