contrib/bkr: add --profile option to set commonly used arguments

This commit is contained in:
Thomas Haller 2014-12-22 16:35:07 +01:00
parent eb9b525117
commit 6f167d957f
2 changed files with 17 additions and 1 deletions

View file

@ -480,6 +480,8 @@ class CmdSubmit(CmdBase):
self.parser.add_argument('--var', '-V', action='append', help='Set template replacements (alternative to setting via environment variables')
self.parser.add_argument('--hosttype', help='The host type. Known values are \'veth\', \'dcb\', \'infiniband\', and \'wifi\'. Anything else uses the default. This determines the $HOSTREQUIRES template')
self.parser.add_argument('--jobtype', help='The job type. Known values are \'rhel70\'. Anything else uses the default to create a retention=scratch job. This determines the $JOBTYPE template')
self.parser.add_argument('--profile', '-p', help='A predefined set of arguments. Known values are \'default\', \'veth\', \'wifi\', \'infiniband\', \'dcb\'.')
def _prepare_rpms(self):
if self.options.rpm is None:
@ -541,6 +543,7 @@ class CmdSubmit(CmdBase):
self.subs['TESTS'] = ','.join(sorted(set(tests)))
self.subs['ARGV'] = ("\"" + "\" \"".join(sys.argv) + "\"") if sys.argv else ''
self.subs['ARGV_PROFILE'] = ("\"" + "\" \"".join(self.argv_profile) + "\"") if getattr(self, 'argv_profile') else ''
for (k,v) in self.subs.iteritems():
self._print_substitution(k, v)
@ -700,6 +703,19 @@ class CmdSubmit(CmdBase):
def run(self, argv):
self.options = self.parser.parse_args(argv)
if self.options.profile:
argv_profiles = {
'default': [ "-s", "CONFIRMED", "-a", "-t", "t-master", "-T", "wifi", "-T", "infiniband", "-T", "dcb", "-T", "no-t-master" ],
'veth': [ "-s", "CONFIRMED", "--hosttype", "veth", "-a", "-t", "t-master", "-T", "wifi", "-T", "infiniband", "-T", "dcb", "-T", "no-t-master" ],
'wifi': [ "-s", "CONFIRMED", "--hosttype", "wifi", "-t", "wifi" ],
'infiniband': [ "-s", "CONFIRMED", "--hosttype", "infiniband", "-t", "infiniband" ],
'dcb': [ "-s", "CONFIRMED", "--hosttype", "dcb", "-t", "dcb" ],
}
if self.options.profile not in argv_profiles:
raise Exception("Unknown profile \"%s\". Valid values are %s" % (self.options.profile, argv_profiles.keys()))
self.argv_profile = argv_profiles[self.options.profile]
self.options = self.parser.parse_args(self.argv_profile + argv)
if self.options.job:
with open(self.options.job) as f:
job0 = list(f)

View file

@ -1,7 +1,7 @@
<job $JOBTYPE>
<whiteboard>
$WHITEBOARD $UUID
$ARGV
$ARGV $ARGV_PROFILE
</whiteboard>
<recipeSet priority="Normal">
<recipe kernel_options="" kernel_options_post="" ks_meta="" role="None" whiteboard="$WHITEBOARD $UUID">