osbuild: make monitor configurable via comandline
Introduce two new command line arguments, which can be used to specify which monitor class to use (`--monitor`) and what file descriptor to use for monitoring (`--monitor-fd`). The latter defaults to standard out. The monitor class, if not specified, is depended on the `--json` argument.
This commit is contained in:
parent
e62133a334
commit
d050c77bfb
1 changed files with 8 additions and 2 deletions
|
|
@ -80,6 +80,10 @@ def parse_arguments(sys_argv):
|
||||||
help="directory where result objects are stored")
|
help="directory where result objects are stored")
|
||||||
parser.add_argument("--inspect", action="store_true",
|
parser.add_argument("--inspect", action="store_true",
|
||||||
help="return the manifest in JSON format including all the ids")
|
help="return the manifest in JSON format including all the ids")
|
||||||
|
parser.add_argument("--monitor", metavar="NAME", default=None,
|
||||||
|
help="Name of the monitor to be used")
|
||||||
|
parser.add_argument("--monitor-fd", metavar="FD", type=int, default=sys.stdout.fileno(),
|
||||||
|
help="File descriptor to be used for the monitor")
|
||||||
parser.add_argument("--stage-timeout", type=int, default=None,
|
parser.add_argument("--stage-timeout", type=int, default=None,
|
||||||
help="set the maximal time (in seconds) each stage is allowed to run")
|
help="set the maximal time (in seconds) each stage is allowed to run")
|
||||||
|
|
||||||
|
|
@ -140,8 +144,10 @@ def osbuild_cli():
|
||||||
print("Need --output-directory for --export")
|
print("Need --output-directory for --export")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
monitor_name = "NullMonitor" if args.json else "LogMonitor"
|
monitor_name = args.monitor
|
||||||
monitor = osbuild.monitor.make(monitor_name, sys.stdout.fileno())
|
if not monitor_name:
|
||||||
|
monitor_name = "NullMonitor" if args.json else "LogMonitor"
|
||||||
|
monitor = osbuild.monitor.make(monitor_name, args.monitor_fd)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with ObjectStore(args.store) as object_store:
|
with ObjectStore(args.store) as object_store:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue