[external_updater] add succeeded/failed on email title
Bug: 171974828
Change-Id: I8c8565686007cd9e412ac9492d305bc88e127d98
diff --git a/notifier.py b/notifier.py
index 7e2e4c7..800a771 100644
--- a/notifier.py
+++ b/notifier.py
@@ -76,8 +76,11 @@
msg = "New version: {}".format(latest_ver)
match = CHANGE_URL_RE.search(upgrade_log)
if match is not None:
+ subject = f"[Succeeded] {proj}"
msg += '\n\nAn upgrade change is generated at:\n{}'.format(
match.group(1))
+ else:
+ subject = f"[Failed] {proj}"
owners = _read_owner_file(proj)
if owners:
@@ -87,7 +90,7 @@
msg += '\n\n'
msg += upgrade_log
- subprocess.run(['sendgmr', '--to=' + recipient, '--subject=' + proj],
+ subprocess.run(['sendgmr', '--to=' + recipient, f'--subject={subject}'],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
@@ -154,7 +157,7 @@
try:
with open(args.history, 'r') as f:
history = json.load(f)
- except FileNotFoundError:
+ except FileNotFoundError, json.decoder.JSONDecodeError:
pass
_process_results(args, history, results)