#NEWLINE# def main( ) : #NEWLINE# #INDENT# logger = logging . getLogger ( ) #NEWLINE# stream = logging . StreamHandler ( sys . stdout ) #NEWLINE# stream . setLevel ( logging . INFO ) #NEWLINE# formatter = logging . Formatter ( '%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) #NEWLINE# stream . setFormatter ( formatter ) #NEWLINE# logger . addHandler ( stream ) #NEWLINE# args = parse_cli_args ( ) #NEWLINE# m = Manager ( logger ) #NEWLINE# if ( args . mode == 'list' ) : #NEWLINE# #INDENT# logger . info ( 'Listing the formations' ) #NEWLINE# m . list_formations ( args . username ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . mode == 'edit' ) : #NEWLINE# #INDENT# logger . info ( 'Editing the formation' ) #NEWLINE# e = FormationEditor ( m , logger ) #NEWLINE# e . edit_formation ( 'args' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . mode == 'verify' ) : #NEWLINE# #INDENT# logger . info ( 'Verifying the formation' ) #NEWLINE# v = VerifyFormations ( m , logger ) #NEWLINE# v . start_verifying ( ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . mode == 'backup' ) : #NEWLINE# #INDENT# logger . info ( 'Backing up a formation' ) #NEWLINE# b = AppBackup ( m , logger ) #NEWLINE# b . backup_formation ( args . username , args . formation , args . directory ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . mode == 'delete' ) : #NEWLINE# #INDENT# logger . info ( 'Deleting a formation' ) #NEWLINE# m . delete_formation ( args . username , args . formation ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . info ( 'Creating a new formation' ) #NEWLINE# m . create_containers ( args . username , args . number , args . formation , args . cpu_shares , args . ram , args . port_list , args . hostname_scheme , args . volume_list , args . image , args . host_server ) #NEWLINE# return 0