Add a CLI output emitter (either to stdout or to filename), based on plan --output/-o flag

This commit is contained in:
Pim van Pelt
2022-04-03 09:49:27 +00:00
parent 8499f2104e
commit 566efe3596
2 changed files with 36 additions and 8 deletions

4
vppcfg
View File

@ -50,6 +50,8 @@ def main():
if args.quiet:
level = logging.WARNING
logging.basicConfig(format='[%(levelname)-8s] %(name)s.%(funcName)s: %(message)s', level=level)
if not args.command:
args.command="check" ## Default check-only
try:
with open(args.config, "r") as f:
@ -106,6 +108,8 @@ def main():
failed = True
logging.warning("Planning sync failure, continuing due to --force")
r.write(args.outfile, ok=not failed)
if failed:
logging.error("Planning failed")
sys.exit(-40)