allow reading most config settings from file
ClosedPublic

Authored by adamwill on Sep 2 2015, 9:25 PM.

Details

Summary

This allows most settings to be specified in the config file.
Defaults for these are set in the config parser; config file
values override defaults, CLI argument values override both
config file and defaults.

There's a few icky little details here, but I can't find any
cleaner way to do this. It'll all be a bit more consistent when
we implement T602: I set up the config file values as if we'd
already done that, so 'compose-wait' is in the 'schedule'
section not the CLI section, but until we do implement T602,
the CLI module has to read that one in. Otherwise the general
rule is that the module methods read in the values from config
if they're passed None, and the CLI passes None if the argument
is not passed. The alternative would be to have the methods
specify their defaults as CONFIG.get(blah) and also have the CLI
arguments' defaults set as CONFIG.get(blah), which avoids the
'if blah is None:' in the methods but means we're duplicating
the 'read default value in from config' logic; it seemed kinda
a toss-up which way was 'better', I went for 'slightly ugly'
over 'duplicated'.

Of note, there isn't a config file setting for 'ifnotcurrent'
(it really feels like a CLI special-sauce option to me), and
there isn't yet a CLI argument for 'jobs-wait' (the setting
that decides how long report-results will wait for jobs to
complete).

Test Plan

Check that all commands still work and that the
defaults, config file override, and CLI override all work as
intended.

Diff Detail

Repository
rOPENQA fedora_openqa
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
adamwill retitled this revision from to allow reading most config settings from file.Sep 2 2015, 9:25 PM
adamwill updated this object.
adamwill edited the test plan for this revision. (Show Details)
adamwill added reviewers: garretraziel, jskladan.
garretraziel accepted this revision.Sep 3 2015, 1:50 PM

This looks good (and seems to work OK :-)). Only nitpick is that when you have submit: false in your config file, fedora-openqa-schedule.py report XYZ doesn't report anything (that is logical behaviour, but perhaps a little bit unexpected :-)).

This revision is now accepted and ready to land.Sep 3 2015, 1:50 PM

It's always been possible to run the report command without submitting anything, and in fact before this commit it was the default mode for the report sub-command (and, before that, for the report-job-results.py script). One side effect of this commit is that 'submit to wiki' becomes the default for the report command, but I think that's OK, it doesn't seem too dangerous or anything. I'm guessing it used to default to false for testing and possibly to protect against dupes, before I had duplicate detection in wikitcms.

This revision was automatically updated to reflect the committed changes.