mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
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:
@@ -74,6 +74,10 @@ def parse_cache_script_args(description):
|
|||||||
"--verbose", dest="verbose", action="store_true",
|
"--verbose", dest="verbose", action="store_true",
|
||||||
help="If specified then script will print a detailed report "
|
help="If specified then script will print a detailed report "
|
||||||
"of what is being will deleted/kept back.")
|
"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 = parser.parse_args()
|
||||||
args.verbose |= args.dry_run # Always print a detailed report in case of dry run.
|
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
|
caches_to_keep = all_caches - caches_to_purge
|
||||||
|
|
||||||
may_be_perform_purging(
|
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:
|
if args.verbose:
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
@@ -321,11 +325,11 @@ def generate_sha1sum_emoji(zulip_path):
|
|||||||
|
|
||||||
return sha.hexdigest()
|
return sha.hexdigest()
|
||||||
|
|
||||||
def may_be_perform_purging(dirs_to_purge, dirs_to_keep, dir_type, dry_run, verbose):
|
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) -> None
|
# type: (Set[str], Set[str], str, bool, bool, bool) -> None
|
||||||
if dry_run:
|
if dry_run:
|
||||||
print("Performing a dry run...")
|
print("Performing a dry run...")
|
||||||
else:
|
if not no_headings:
|
||||||
print("Cleaning unused %ss..." % (dir_type,))
|
print("Cleaning unused %ss..." % (dir_type,))
|
||||||
|
|
||||||
for directory in dirs_to_purge:
|
for directory in dirs_to_purge:
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def main():
|
|||||||
deployments_to_purge = get_deployments_to_be_purged(deployments_to_keep)
|
deployments_to_purge = get_deployments_to_be_purged(deployments_to_keep)
|
||||||
|
|
||||||
may_be_perform_purging(
|
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:
|
if not args.dry_run:
|
||||||
print("Deployments cleaned successfully...")
|
print("Deployments cleaned successfully...")
|
||||||
|
|||||||
Reference in New Issue
Block a user