From f2134fc9167a19e460706843a427cb1dbff39150 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Sep 21 2016 17:33:56 +0000 Subject: fix pruning of old dir and checksum file processing, don't mention 'latest' in email until that's done Signed-off-by: Adam Miller --- diff --git a/scripts/push-two-week-atomic.py b/scripts/push-two-week-atomic.py index 31e228e..b04734e 100755 --- a/scripts/push-two-week-atomic.py +++ b/scripts/push-two-week-atomic.py @@ -394,9 +394,6 @@ Images can be found here: Respective signed CHECKSUM files can be found here: {} -For direct download, the "latest" target is always available here: -https://download.fedoraproject.org/pub/alt/atomic/stable/latest/ - Thank you, Fedora Release Engineering """.format( @@ -586,34 +583,35 @@ def prune_old_composes(prune_base_dir, prune_limit): prune_candidate_dirs = os.listdir(prune_base_dir) - # Sort then reverse so we can slice the list from [0:prune_limit] - prune_candidate_dirs.sort() - prune_candidate_dirs.reverse() - - for candidate_dir in prune_candidate_dirs[0:prune_limit]: - #try: - # shutil.rmtree( - # os.path.join(prune_base_dir, candidate_dir) - # ) - #except OSError, e: - # log.error( - # "Error trying to remove directory: {}\n{}".format( - # candidate_dir, - # e - # ) - # ) - - #FIXME - need to do this with sudo until pungi perms are fixed - prune_cmd = "sudo rm -fr {}".format( - os.path.join( - prune_base_dir, - candidate_dir - ) - ) - if subprocess.call(prune_cmd.split()): - log.error( - "prune_old_composes: command failed: {}".format(prune_cmd) + if len(prune_candidate_dirs) > 2: + # Sort then reverse so we can slice the list from [0:prune_limit] + prune_candidate_dirs.sort() + prune_candidate_dirs.reverse() + + for candidate_dir in prune_candidate_dirs[0:prune_limit]: + #try: + # shutil.rmtree( + # os.path.join(prune_base_dir, candidate_dir) + # ) + #except OSError, e: + # log.error( + # "Error trying to remove directory: {}\n{}".format( + # candidate_dir, + # e + # ) + # ) + + #FIXME - need to do this with sudo until pungi perms are fixed + prune_cmd = "sudo rm -fr {}".format( + os.path.join( + prune_base_dir, + candidate_dir + ) ) + if subprocess.call(prune_cmd.split()): + log.error( + "prune_old_composes: command failed: {}".format(prune_cmd) + ) if __name__ == '__main__': @@ -683,7 +681,7 @@ if __name__ == '__main__': # Find all the Atomic images and CHECKSUM files to include in the email email_filelist = [] for full_dir_path, _, short_names in \ - os.walk(os.join(ATOMIC_STABLE_BASEDIR, compose_id)): + os.walk(os.path.join(ATOMIC_STABLE_BASEDIR, compose_id)): for sname in fnmatch.filter(short_names, '*Atomic*'): email_filelist.append( os.path.join(