pungi/pungi/scripts/report_progress.py
Haibo Lin 3cf16eb42d cleanup: refactor scripts via entry points
Fixes: https://pagure.io/pungi/issue/1045
JIRA: COMPOSE-2946
Signed-off-by: Haibo Lin <hlin@redhat.com>
2019-12-10 10:53:31 +08:00

24 lines
604 B
Python

from __future__ import print_function
import argparse
import json
import os
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument('cmd')
opts = parser.parse_args()
data = json.load(sys.stdin)
compose = data["location"]
dest = os.environ["_PUNGI_ORCHESTRATOR_PROGRESS_MONITOR"]
with open(dest, "a") as f:
if opts.cmd == "phase-start":
print("%s: phase %s started" % (compose, data["phase_name"]), file=f)
elif opts.cmd == "phase-stop":
print("%s: phase %s finished" % (compose, data["phase_name"]), file=f)