mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	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:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							6936bb1ba0
						
					
				
				
					commit
					504abfce63
				
			@@ -1,5 +1,6 @@
 | 
				
			|||||||
#!/usr/bin/env python3
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
from __future__ import print_function
 | 
					from __future__ import print_function
 | 
				
			||||||
 | 
					import argparse
 | 
				
			||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
import errno
 | 
					import errno
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
@@ -34,6 +35,19 @@ BLUE = '\x1b[34m'
 | 
				
			|||||||
MAGENTA = '\x1b[35m'
 | 
					MAGENTA = '\x1b[35m'
 | 
				
			||||||
CYAN = '\x1b[36m'
 | 
					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):
 | 
					def get_deployment_version(extract_path):
 | 
				
			||||||
    # type: (str) -> str
 | 
					    # type: (str) -> str
 | 
				
			||||||
    version = '0.0.0'
 | 
					    version = '0.0.0'
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user