<s> import argparse <EOL> import json <EOL> import logging <EOL> import os <EOL> import sys <EOL> from urlparse import urlparse <EOL> from functools import wraps <EOL> from zinc . utils import canonical_path <EOL> from zinc . models import ZincFlavorSpec <EOL> from zinc . formats import Formats <EOL> from zinc . client import ZincClientConfig <EOL> import zinc . client as client <EOL> import zinc . helpers as helpers <EOL> import zinc . utils as utils <EOL> log = logging . getLogger ( __name__ ) <EOL> DEFAULT_CONFIG_PATH = '<STR_LIT>' <EOL> def load_config ( path ) : <EOL> path = canonical_path ( path ) <EOL> is_default = path == canonical_path ( DEFAULT_CONFIG_PATH ) <EOL> exists = os . path . exists ( path ) <EOL> if is_default and not exists : <EOL> return ZincClientConfig ( ) <EOL> if not exists : <EOL> sys . exit ( "<STR_LIT>" % ( path ) ) <EOL> return ZincClientConfig . from_path ( path ) <EOL> def set_loglevel ( cargs ) : <EOL> if cargs . loglevel == '<STR_LIT>' : <EOL> logging . basicConfig ( level = logging . DEBUG , <EOL> format = '<STR_LIT>' ) <EOL> else : <EOL> logging . basicConfig ( level = logging . INFO , <EOL> format = '<STR_LIT>' ) <EOL> def catalog_from_config ( config , catalog_ref ) : <EOL> if config . bookmarks . get ( catalog_ref ) : <EOL> catalog_id = config . bookmarks [ catalog_ref ] [ '<STR_LIT>' ] <EOL> coordinator_info = config . coordinators [ config . bookmarks [ catalog_ref ] [ '<STR_LIT>' ] ] <EOL> storage_info = config . storages [ config . bookmarks [ catalog_ref ] [ '<STR_LIT>' ] ] <EOL> return catalog_id , coordinator_info , storage_info <EOL> return None , None , None <EOL> def resolve_storage_info ( config , storage_ref ) : <EOL> urlcomps = urlparse ( storage_ref ) <EOL> if not urlcomps . scheme == '<STR_LIT>' : <EOL> return { '<STR_LIT:url>' : storage_ref } <EOL> storage_info = config . storages . get ( storage_ref ) <EOL> if storage_info is not None : <EOL> return storage_info <EOL> path = canonical_path ( storage_ref ) <EOL> return { '<STR_LIT:url>' : '<STR_LIT>' % ( path ) } <EOL> def get_catalog ( config , cargs ) : <EOL> catalog_id , coordinator_info , storage_info = catalog_from_config ( config , cargs . catalog ) <EOL> timeout = vars ( cargs ) . get ( '<STR_LIT>' ) <EOL> if coordinator_info is not None and storage_info is not None : <EOL> service = client . connect ( coordinator_info = coordinator_info , storage_info = storage_info ) <EOL> catalog = service . get_catalog ( id = catalog_id , lock_timeout = timeout ) <EOL> else : <EOL> service = client . connect ( cargs . catalog ) <EOL> catalog = service . get_catalog ( lock_timeout = timeout ) <EOL> return catalog <EOL> def parse_single_version_ish ( catalog , bundle_name , version_string ) : <EOL> if version_string in client . SymbolicSingleBundleVersions or version_string . startswith ( client . BundleVersionDistroPrefix ) : <EOL> bundle_version = version_string <EOL> else : <EOL> bundle_version = int ( version_string ) <EOL> return bundle_version <EOL> def parse_multi_version_ish ( catalog , bundle_name , version_list ) : <EOL> parsed_version_list = list ( ) <EOL> for version in version_list : <EOL> if version in client . SymbolicBundleVersions : <EOL> parsed_version = version <EOL> else : <EOL> parsed_version = int ( version ) <EOL> parsed_version_list . append ( parsed_version ) <EOL> return parsed_version_list <EOL> def bundle_update ( catalog , bundle_name , path , flavors = None , force = False , <EOL> skip_master_archive = True ) : <EOL> manifest = client . create_bundle_version ( catalog , bundle_name , path , <EOL> flavor_spec = flavors , force = force , <EOL> skip_master_archive = skip_master_archive ) <EOL> print "<STR_LIT>" % ( manifest . version ) <EOL> def bundle_delete ( catalog , bundle_name , versions , dry_run = False ) : <EOL> if len ( versions ) == <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> else : <EOL> verb = '<STR_LIT>' if dry_run else '<STR_LIT>' <EOL> print "<STR_LIT>" % ( verb , versions ) <EOL> if not dry_run : <EOL> client . delete_bundle_versions ( catalog , bundle_name , versions ) <EOL> def distro_update ( catalog , bundle_name , distro_name , version , <EOL> save_previous = True ) : <EOL> errors = helpers . distro_name_errors ( distro_name ) <EOL> if len ( errors ) > <NUM_LIT:0> : <EOL> for e in errors : <EOL> log . error ( e ) <EOL> sys . exit ( ) <EOL> client . update_distribution ( catalog , distro_name , bundle_name , version , <EOL> save_previous = save_previous ) <EOL> def distro_delete ( catalog , distro_name , bundle_name ) : <EOL> catalog . delete_distribution ( distro_name , bundle_name ) <EOL> def flavorspec_list ( catalog ) : <EOL> for n in catalog . get_flavorspec_names ( ) : <EOL> print n <EOL> def flavorspec_update ( catalog , path , name ) : <EOL> catalog . update_flavorspec_from_path ( path , name = name ) <EOL> def flavorspec_delete ( catalog , name ) : <EOL> catalog . delete_flavorspec ( name ) <EOL> def cli_cmd ( f ) : <EOL> @ wraps ( f ) <EOL> def func ( self , * args , ** kwargs ) : <EOL> results = f ( self , * args , ** kwargs ) <EOL> for result in results : <EOL> print result . format ( args [ <NUM_LIT:0> ] . format ) <EOL> errors = results . errors ( ) <EOL> if len ( errors ) > <NUM_LIT:0> : <EOL> print "<STR_LIT>" <EOL> for error in errors : <EOL> print error . format ( args [ <NUM_LIT:0> ] . format ) <EOL> return func <EOL> @ cli_cmd <EOL> def subcmd_catalog_list ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> return client . catalog_list ( catalog , distro = cargs . distro , <EOL> print_versions = not cargs . no_versions ) <EOL> def subcmd_catalog_create ( config , cargs ) : <EOL> storage_ref = cargs . storage <EOL> catalog_id = cargs . catalog_id <EOL> storage_info = resolve_storage_info ( config , storage_ref ) <EOL> client . create_catalog ( catalog_id = catalog_id , storage_info = storage_info ) <EOL> print "<STR_LIT>" % ( catalog_id ) <EOL> def subcmd_catalog_clean ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> catalog . clean ( dry_run = not cargs . force ) <EOL> @ cli_cmd <EOL> def subcmd_bundle_list ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> version = parse_single_version_ish ( catalog , bundle_name , cargs . version ) <EOL> print_sha = cargs . sha <EOL> flavor_name = cargs . flavor <EOL> return client . bundle_list ( catalog , bundle_name , version , <EOL> print_sha = print_sha , flavor_name = flavor_name ) <EOL> def subcmd_bundle_update ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> flavors = None <EOL> if cargs . flavors is not None : <EOL> try : <EOL> with open ( cargs . flavors ) as f : <EOL> flavors_dict = json . load ( f ) <EOL> flavors = ZincFlavorSpec . from_dict ( flavors_dict ) <EOL> except IOError : <EOL> flavors = catalog . get_flavorspec ( cargs . flavors ) <EOL> assert flavors is not None <EOL> bundle_name = cargs . bundle <EOL> path = cargs . path <EOL> force = cargs . force <EOL> skip_master_archive = cargs . skip_master_archive <EOL> bundle_update ( catalog , bundle_name , path , flavors = flavors , force = force , <EOL> skip_master_archive = skip_master_archive ) <EOL> def subcmd_bundle_clone ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> bundle_id = helpers . make_bundle_id ( catalog . id , bundle_name ) <EOL> version = parse_single_version_ish ( catalog , bundle_name , cargs . version ) <EOL> flavor = cargs . flavor <EOL> root_path = cargs . path <EOL> if cargs . no_versions : <EOL> bundle_dir_name = bundle_id <EOL> else : <EOL> bundle_dir_name = None <EOL> client . clone_bundle ( catalog , bundle_name , version , root_path = root_path , <EOL> bundle_dir_name = bundle_dir_name , flavor = flavor ) <EOL> if cargs . include_manifest : <EOL> if cargs . no_versions : <EOL> manifest_name = '<STR_LIT>' % ( bundle_id ) <EOL> else : <EOL> manifest_name = '<STR_LIT>' % ( helpers . make_bundle_descriptor ( bundle_id , version ) ) <EOL> manifest_dest_path = os . path . join ( root_path , manifest_name ) <EOL> manifest_src_path = catalog . path_helper . path_for_manifest_for_bundle_version ( bundle_name , version ) <EOL> _dump_json ( catalog , manifest_src_path , dest_path = manifest_dest_path ) <EOL> def subcmd_bundle_delete ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> versions = parse_multi_version_ish ( catalog , bundle_name , cargs . versions ) <EOL> dry_run = cargs . dry_run <EOL> bundle_delete ( catalog , bundle_name , versions , dry_run = dry_run ) <EOL> @ cli_cmd <EOL> def subcmd_bundle_verify ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> version_ish = parse_single_version_ish ( catalog , bundle_name , cargs . version ) <EOL> return client . bundle_verify ( catalog , bundle_name , version_ish ) <EOL> def subcmd_distro_update ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> distro_name = cargs . distro <EOL> version = parse_single_version_ish ( catalog , bundle_name , cargs . version ) <EOL> save_previous = not cargs . no_prev_distro <EOL> distro_update ( catalog , bundle_name , distro_name , version , <EOL> save_previous = save_previous ) <EOL> def subcmd_distro_delete ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> distro_name = cargs . distro <EOL> distro_delete ( catalog , distro_name , bundle_name ) <EOL> def subcmd_flavorspec_list ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> flavorspec_list ( catalog ) <EOL> def subcmd_flavorspec_update ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> name = cargs . name <EOL> path = cargs . path <EOL> flavorspec_update ( catalog , path , name ) <EOL> def subcmd_flavorspec_delete ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> flavorspec_delete ( catalog , cargs . name ) <EOL> @ cli_cmd <EOL> def subcmd_catalog_verify ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> should_lock = cargs . lock <EOL> return client . verify_catalog ( catalog , should_lock = should_lock ) <EOL> def _dump_json ( catalog , subpath , dest_path = None , should_decompress = True , gzip = True ) : <EOL> if gzip : <EOL> subpath = helpers . append_file_extension_for_format ( subpath , Formats . GZ ) <EOL> data = catalog . _read ( subpath ) <EOL> if gzip and should_decompress : <EOL> out = utils . gunzip_bytes ( data ) <EOL> else : <EOL> out = data <EOL> if dest_path is not None : <EOL> with open ( dest_path , '<STR_LIT>' ) as f : <EOL> f . write ( out ) <EOL> log . info ( '<STR_LIT>' % ( dest_path ) ) <EOL> else : <EOL> print out <EOL> def _dump_get_dest_path ( subpath , cargs ) : <EOL> if cargs . remote_name : <EOL> return os . path . split ( subpath ) [ - <NUM_LIT:1> ] <EOL> else : <EOL> return None <EOL> def subcmd_dump_index ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> subpath = catalog . path_helper . path_for_index ( ) <EOL> dest_path = _dump_get_dest_path ( subpath , cargs ) <EOL> _dump_json ( catalog , subpath , should_decompress = not cargs . no_decompress , <EOL> dest_path = dest_path ) <EOL> def subcmd_dump_manifest ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> bundle_name = cargs . bundle <EOL> version = parse_single_version_ish ( catalog , bundle_name , cargs . version ) <EOL> subpath = catalog . path_helper . path_for_manifest_for_bundle_version ( bundle_name , version ) <EOL> dest_path = _dump_get_dest_path ( subpath , cargs ) <EOL> _dump_json ( catalog , subpath , should_decompress = not cargs . no_decompress , <EOL> dest_path = dest_path ) <EOL> def subcmd_dump_flavorspec ( config , cargs ) : <EOL> catalog = get_catalog ( config , cargs ) <EOL> subpath = catalog . path_helper . path_for_flavorspec_name ( cargs . name ) <EOL> dest_path = _dump_get_dest_path ( subpath , cargs ) <EOL> _dump_json ( catalog , subpath , dest_path = dest_path , gzip = False ) <EOL> def subcmd_debug_flavors ( config , cargs ) : <EOL> flavors = ZincFlavorSpec . from_path ( cargs . flavors ) <EOL> for flavor_name in flavors . flavors : <EOL> print '<STR_LIT>' % flavor_name <EOL> filter = flavors . filter_for_flavor ( flavor_name ) <EOL> src_dir = cargs . path <EOL> for root , dirs , files in os . walk ( src_dir ) : <EOL> for f in files : <EOL> rel_dir = root [ len ( src_dir ) + <NUM_LIT:1> : ] <EOL> rel_path = os . path . join ( rel_dir , f ) <EOL> matched = filter . match ( rel_path ) <EOL> print '<STR_LIT>' % ( '<STR_LIT:+>' if matched else '<STR_LIT:->' , rel_path ) <EOL> print "<STR_LIT>" <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> default = DEFAULT_CONFIG_PATH , <EOL> help = '<STR_LIT>' % ( DEFAULT_CONFIG_PATH ) ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> choices = ( client . OutputType . PRETTY , <EOL> client . OutputType . JSON ) , <EOL> default = client . OutputType . PRETTY ) <EOL> parser . add_argument ( '<STR_LIT>' , default = '<STR_LIT:error>' , <EOL> choices = ( '<STR_LIT:info>' , '<STR_LIT>' ) , <EOL> help = '<STR_LIT>' ) <EOL> subparsers = parser . add_subparsers ( title = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg = lambda parser , required = True : parser . add_argument ( <EOL> '<STR_LIT:-c>' , '<STR_LIT>' , required = required , help = '<STR_LIT>' ) <EOL> add_bundle_arg = lambda parser , required = True : parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , required = True , help = '<STR_LIT>' ) <EOL> add_distro_arg = lambda parser , required = True : parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , required = required , help = '<STR_LIT>' ) <EOL> add_single_version_arg = lambda parser , required = True : parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , required = required , help = '<STR_LIT>' ) <EOL> add_multiple_versions_arg = lambda parser , required = True : parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , nargs = '<STR_LIT:+>' , required = required , <EOL> help = '<STR_LIT>' ) <EOL> add_timeout_arg = lambda parser , required = False : parser . add_argument ( <EOL> '<STR_LIT>' , required = required , default = None , <EOL> help = '<STR_LIT>' ) <EOL> add_remote_name_arg = lambda parser , required = False : parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , required = required , default = False , <EOL> action = '<STR_LIT:store_true>' , help = '<STR_LIT>' ) <EOL> add_no_decompress_arg = lambda parser , required = False : parser . add_argument ( <EOL> '<STR_LIT>' , required = required , default = False , <EOL> action = '<STR_LIT:store_true>' , help = '<STR_LIT>' ) <EOL> parser_catalog_create = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_catalog_create . add_argument ( '<STR_LIT>' ) <EOL> parser_catalog_create . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = '<STR_LIT:.>' ) <EOL> parser_catalog_create . set_defaults ( func = subcmd_catalog_create ) <EOL> parser_catalog_clean = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_catalog_clean ) <EOL> add_timeout_arg ( parser_catalog_clean ) <EOL> parser_catalog_clean . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_catalog_clean . set_defaults ( func = subcmd_catalog_clean ) <EOL> parser_catalog_verify = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_catalog_verify ) <EOL> parser_catalog_verify . add_argument ( '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_catalog_verify . set_defaults ( func = subcmd_catalog_verify ) <EOL> parser_catalog_list = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_catalog_list ) <EOL> add_distro_arg ( parser_catalog_list , required = False ) <EOL> parser_catalog_list . add_argument ( '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_catalog_list . set_defaults ( func = subcmd_catalog_list ) <EOL> parser_bundle_list = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_bundle_list ) <EOL> add_bundle_arg ( parser_bundle_list ) <EOL> add_single_version_arg ( parser_bundle_list ) <EOL> parser_bundle_list . add_argument ( '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_list . add_argument ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_list . set_defaults ( func = subcmd_bundle_list ) <EOL> parser_bundle_update = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_bundle_update ) <EOL> add_timeout_arg ( parser_bundle_update ) <EOL> add_bundle_arg ( parser_bundle_update ) <EOL> parser_bundle_update . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> required = True , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_update . add_argument ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_update . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_update_master_archive_group = parser_bundle_update . add_mutually_exclusive_group ( ) <EOL> parser_bundle_update_master_archive_group . add_argument ( '<STR_LIT>' , <EOL> default = True , <EOL> action = '<STR_LIT:store_true>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_update_master_archive_group . add_argument ( '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_update . set_defaults ( func = subcmd_bundle_update ) <EOL> parser_bundle_clone = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_bundle_clone ) <EOL> add_bundle_arg ( parser_bundle_clone ) <EOL> add_single_version_arg ( parser_bundle_clone ) <EOL> parser_bundle_clone . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> required = False , <EOL> default = '<STR_LIT:.>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_clone . add_argument ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_clone . add_argument ( '<STR_LIT>' , <EOL> required = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_clone . add_argument ( '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_clone . set_defaults ( func = subcmd_bundle_clone ) <EOL> parser_bundle_delete = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_bundle_delete ) <EOL> add_timeout_arg ( parser_bundle_delete ) <EOL> add_bundle_arg ( parser_bundle_delete ) <EOL> add_multiple_versions_arg ( parser_bundle_delete ) <EOL> parser_bundle_delete . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_bundle_delete . set_defaults ( func = subcmd_bundle_delete ) <EOL> parser_bundle_verify = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_bundle_verify ) <EOL> add_bundle_arg ( parser_bundle_verify ) <EOL> add_single_version_arg ( parser_bundle_verify ) <EOL> parser_bundle_verify . set_defaults ( func = subcmd_bundle_verify ) <EOL> parser_distro_update = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_distro_update ) <EOL> add_timeout_arg ( parser_distro_update ) <EOL> add_bundle_arg ( parser_distro_update ) <EOL> add_single_version_arg ( parser_distro_update ) <EOL> add_distro_arg ( parser_distro_update ) <EOL> parser_distro_update . add_argument ( '<STR_LIT>' , <EOL> default = False , <EOL> action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_distro_update . set_defaults ( func = subcmd_distro_update ) <EOL> parser_distro_delete = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_distro_delete ) <EOL> add_timeout_arg ( parser_distro_delete ) <EOL> add_bundle_arg ( parser_distro_delete ) <EOL> add_distro_arg ( parser_distro_delete ) <EOL> parser_distro_delete . set_defaults ( func = subcmd_distro_delete ) <EOL> parser_flavorspec_list = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_flavorspec_list ) <EOL> parser_flavorspec_list . set_defaults ( func = subcmd_flavorspec_list ) <EOL> parser_flavorspec_update = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_flavorspec_update ) <EOL> parser_flavorspec_update . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> required = True , <EOL> help = '<STR_LIT>' ) <EOL> parser_flavorspec_update . add_argument ( '<STR_LIT>' , <EOL> required = False , <EOL> help = '<STR_LIT>' ) <EOL> parser_flavorspec_update . set_defaults ( func = subcmd_flavorspec_update ) <EOL> parser_flavorspec_delete = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_flavorspec_delete ) <EOL> parser_flavorspec_delete . add_argument ( '<STR_LIT>' , <EOL> required = True , <EOL> help = '<STR_LIT>' ) <EOL> parser_flavorspec_delete . set_defaults ( func = subcmd_flavorspec_delete ) <EOL> parser_dump_index = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_dump_index ) <EOL> add_remote_name_arg ( parser_dump_index ) <EOL> add_no_decompress_arg ( parser_dump_index ) <EOL> parser_dump_index . set_defaults ( func = subcmd_dump_index ) <EOL> parser_dump_manifest = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_dump_manifest ) <EOL> add_bundle_arg ( parser_dump_manifest ) <EOL> add_single_version_arg ( parser_dump_manifest ) <EOL> add_remote_name_arg ( parser_dump_manifest ) <EOL> add_no_decompress_arg ( parser_dump_manifest ) <EOL> parser_dump_manifest . set_defaults ( func = subcmd_dump_manifest ) <EOL> parser_dump_flavorspec = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_dump_flavorspec . add_argument ( '<STR_LIT>' , <EOL> required = True , <EOL> help = '<STR_LIT>' ) <EOL> add_catalog_arg ( parser_dump_flavorspec ) <EOL> add_remote_name_arg ( parser_dump_flavorspec ) <EOL> parser_dump_flavorspec . set_defaults ( func = subcmd_dump_flavorspec ) <EOL> parser_debug_flavors = subparsers . add_parser ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_debug_flavors . add_argument ( '<STR_LIT>' , <EOL> required = True , <EOL> help = '<STR_LIT>' ) <EOL> parser_debug_flavors . add_argument ( '<STR_LIT>' , '<STR_LIT>' , <EOL> required = False , <EOL> default = '<STR_LIT:.>' , <EOL> help = '<STR_LIT>' ) <EOL> parser_debug_flavors . set_defaults ( func = subcmd_debug_flavors ) <EOL> args = parser . parse_args ( ) <EOL> config = load_config ( args . config ) <EOL> set_loglevel ( args ) <EOL> args . func ( config , args ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
