config-dump: Allow freezing koji event

Accept similar argument to pungi-koji: either direct event ID, or a path
to a compose from which the event will be extracted.

It would be nice if we could reuse the path to compose given as source,
but there may be more that one compose, so ultimately we need a way to
overwrite it anyway.

JIRA: COMPOSE-3278
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-02-26 10:50:24 +01:00
parent fa47d9edba
commit 8b84aa384a

View File

@ -10,6 +10,7 @@ import sys
import kobo.conf
import pungi.checks
import pungi.util
def load_file(source, conf):
@ -38,6 +39,15 @@ def main():
"or arbitrary number of config files."
),
)
parser.add_argument(
"--freeze-event",
metavar="ID",
type=pungi.util.parse_koji_event,
help=(
"Include this koji event in the created config; "
"takes either event ID or path to a compose"
),
)
group = parser.add_mutually_exclusive_group()
group.add_argument(
"--just-dump",
@ -65,6 +75,9 @@ def main():
print(error, file=sys.stderr)
return False
if args.freeze_event:
conf["koji_event"] = args.freeze_event
json.dump(conf, sys.stdout, sort_keys=True, indent=4)
return True