mirror of https://github.com/zulip/zulip.git
scripts: Clean up output from 'clean_unused_caches'.
The output log from running clean_unused_caches was too verbose as part of the `upgrade-zulip` overall output. While this output is potentially helpful when running it directly for debugging, it's certainly redundant for the main production use case. So a new flag --no-print-headers is introduced. It suppresses the header outputs for the subtools. Fixes #13214.
This commit is contained in:
parent
c42077c12f
commit
71f0fecda7
|
@ -74,6 +74,10 @@ def parse_cache_script_args(description):
|
|||
"--verbose", dest="verbose", action="store_true",
|
||||
help="If specified then script will print a detailed report "
|
||||
"of what is being will deleted/kept back.")
|
||||
parser.add_argument(
|
||||
"--no-print-headings", dest="no_headings", action="store_true",
|
||||
help="If specified then script will not print headings for "
|
||||
"what will be deleted/kept back.")
|
||||
|
||||
args = parser.parse_args()
|
||||
args.verbose |= args.dry_run # Always print a detailed report in case of dry run.
|
||||
|
@ -290,7 +294,7 @@ def purge_unused_caches(caches_dir, caches_in_use, cache_type, args):
|
|||
caches_to_keep = all_caches - caches_to_purge
|
||||
|
||||
may_be_perform_purging(
|
||||
caches_to_purge, caches_to_keep, cache_type, args.dry_run, args.verbose)
|
||||
caches_to_purge, caches_to_keep, cache_type, args.dry_run, args.verbose, args.no_headings)
|
||||
if args.verbose:
|
||||
print("Done!")
|
||||
|
||||
|
@ -321,11 +325,11 @@ def generate_sha1sum_emoji(zulip_path):
|
|||
|
||||
return sha.hexdigest()
|
||||
|
||||
def may_be_perform_purging(dirs_to_purge, dirs_to_keep, dir_type, dry_run, verbose):
|
||||
# type: (Set[str], Set[str], str, bool, bool) -> None
|
||||
def may_be_perform_purging(dirs_to_purge, dirs_to_keep, dir_type, dry_run, verbose, no_headings):
|
||||
# type: (Set[str], Set[str], str, bool, bool, bool) -> None
|
||||
if dry_run:
|
||||
print("Performing a dry run...")
|
||||
else:
|
||||
if not no_headings:
|
||||
print("Cleaning unused %ss..." % (dir_type,))
|
||||
|
||||
for directory in dirs_to_purge:
|
||||
|
|
|
@ -59,7 +59,7 @@ def main():
|
|||
deployments_to_purge = get_deployments_to_be_purged(deployments_to_keep)
|
||||
|
||||
may_be_perform_purging(
|
||||
deployments_to_purge, deployments_to_keep, "deployment", args.dry_run, args.verbose)
|
||||
deployments_to_purge, deployments_to_keep, "deployment", args.dry_run, args.verbose, True)
|
||||
|
||||
if not args.dry_run:
|
||||
print("Deployments cleaned successfully...")
|
||||
|
|
Loading…
Reference in New Issue