Skip to content

Commit c3cbf40

Browse files
committed
dns: handle push failures
* GitPython doesn't raise an exception if a failure occurs when pushing to the remote. Handling the error based on the push flags. See also: gitpython-developers/GitPython#621 Bug: T233183 Change-Id: I0e52940691080baf95fa4b2da9328e4557ad395f
1 parent f26a3b9 commit c3cbf40

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: dns/generate_dns_snippets.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,19 @@ def run(args: argparse.Namespace, config: ConfigParser, tmpdir: str) -> int:
276276
origin=config.get('dns_snippets', 'repo_path')))
277277
if answer == 'y':
278278
push_info = working_repo.remote().push()[0]
279-
logger.info('Pushed with bitflags %d: %s %s', push_info.flags, push_info.summary.strip(), commit.stats.total)
280-
exit_code = 0
279+
if push_info.flags & push_info.ERROR == push_info.ERROR:
280+
level = logging.ERROR
281+
exit_code = 2
282+
else:
283+
level = logging.INFO
284+
exit_code = 0
285+
286+
logger.log(level, 'Pushed with bitflags %d: %s %s',
287+
push_info.flags, push_info.summary.strip(), commit.stats.total)
288+
281289
else:
282290
logger.error('Manually aborted.')
283-
exit_code = 2
291+
exit_code = 3
284292

285293
return exit_code
286294

0 commit comments

Comments
 (0)