#NEWLINE# def run_commands( command , environment , configuration_directory ) : #NEWLINE# #INDENT# configuration_directory = os . path . abspath ( configuration_directory ) #NEWLINE# loader = _get_and_test_loader ( configuration_directory ) #NEWLINE# if ( loader is None ) : #NEWLINE# #INDENT# return 1 #NEWLINE# #UNINDENT# configuration = _get_and_test_configuration ( loader ) #NEWLINE# if ( configuration is None ) : #NEWLINE# #INDENT# return 1 #NEWLINE# #UNINDENT# if ( environment is None ) : #NEWLINE# #INDENT# available_environments = configuration . get_available_environments ( ) #NEWLINE# if ( len ( available_environments ) == 1 ) : #NEWLINE# #INDENT# environment = available_environments [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . critical ( 'An environment option is required. Available options: %s' , available_environments ) #NEWLINE# return COMMAND_ERROR_CODES [ 'INVALID_COMMAND_OPTIONS' ] #NEWLINE# #UNINDENT# #UNINDENT# if ( command == 'check' ) : #NEWLINE# #INDENT# do_configuration_check ( configuration_directory , environment , configuration ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( configuration_directory == 'up' ) : #NEWLINE# #INDENT# do_up ( configuration_directory , environment , configuration ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( command == 'view' ) : #NEWLINE# #INDENT# do_view ( configuration_directory , environment , configuration ) #NEWLINE# return 0