zulip_tools.py: Add `GENERIC_CACHE_SCRIPT_PARSER`.

This parser will act as a parent parser for all the cache cleaning scripts.
This commit is contained in:
Harshit Bansal 2017-08-21 23:11:19 +05:30 committed by Tim Abbott
parent 6936bb1ba0
commit 504abfce63
1 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
from __future__ import print_function
import argparse
import datetime
import errno
import logging
@ -34,6 +35,19 @@ BLUE = '\x1b[34m'
MAGENTA = '\x1b[35m'
CYAN = '\x1b[36m'
# Parent parser for cache cleaning scripts.
GENERIC_CACHE_SCRIPT_PARSER = argparse.ArgumentParser(add_help=False)
GENERIC_CACHE_SCRIPT_PARSER.add_argument(
"--threshold", dest="threshold_days", type=int, default=14,
nargs="?", metavar="<days>", help="Any cache which is not in "
"use by a deployment not older than threshold days(current "
"installation in dev) and older than threshold days will be "
"deleted. (defaults to 14)")
GENERIC_CACHE_SCRIPT_PARSER.add_argument(
"--dry-run", dest="dry_run", action="store_true",
help="If specified then script will only print the caches "
"that it will delete/keep back. It will not delete any cache.")
def get_deployment_version(extract_path):
# type: (str) -> str
version = '0.0.0'