From 0a6f7ec5ef74673419d068b2da2920bfc66acb72 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: May 23 2017 22:02:21 +0000 Subject: Improve errors, koji watch only as needed, and missing Dockerfile Signed-off-by: Adam Miller --- diff --git a/flr/koji.py b/flr/koji.py index a77fc16..2f50982 100644 --- a/flr/koji.py +++ b/flr/koji.py @@ -220,8 +220,12 @@ def rebuild(build_type, branch, anames, user=None, stage=False): flr.log.info("Loading Dockerfile content") dfp = DockerfileParser() - with open('Dockerfile', 'r') as dkr_file: - dfp.content = ''.join(dkr_file.readlines()) + try: + with open('Dockerfile', 'r') as dkr_file: + dfp.content = ''.join(dkr_file.readlines()) + except IOError: + flr.log.error("NO DOCKERFILE FOUND") + continue # Bump the RELEASE ENV var for the rebuild flr.log.info("Bumping RELEASE in Dockerfile") @@ -243,11 +247,12 @@ def rebuild(build_type, branch, anames, user=None, stage=False): dfp_newrel.append(str(int(dfp_relsplit[-1]) + 1)) dfp.envs[release_str] = u'{}'.format('.'.join(dfp_newrel)) else: - flr.log.info("FAILED TO BUMP RELEASE - SKIPPING: {}/{}".format( + flr.log.error("FAILED TO BUMP RELEASE - SKIPPING: {}/{}".format( cntr_ns, aname ) ) + continue # commit changes cmd = fedpkg_prefix + [ @@ -282,9 +287,10 @@ def rebuild(build_type, branch, anames, user=None, stage=False): shutil.rmtree(os.path.join(work_dir, aname)) # Wait for the koji tasks - flr.log.info("Waiting for koji tasks to complete.") - cmd = koji_prefix + ['watch-task'] - cmd.extend(koji_tasks) - flr.util.subproc_call(cmd) + if koji_tasks: + flr.log.info("Waiting for koji tasks to complete.") + cmd = koji_prefix + ['watch-task'] + cmd.extend(koji_tasks) + flr.util.subproc_call(cmd) # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4