예제 #1
0
    def execute(self, parameter_pool):
        create_eb_local_dir()

        app_name = parameter_pool.get_value(ParameterName.ApplicationName)
        env_name = parameter_pool.get_value(ParameterName.EnvironmentName)
        location = parameter_pool.get_value(ParameterName.OptionSettingFile)            

        prompt.action(SaveConfigurationSettingOpMessage.Start.format(env_name))
        
        try:
            option_settings = api_wrapper.retrieve_configuration_settings(parameter_pool,
                                                                          app_name,
                                                                          env_name)
            config_file.save_env_option_setting_file(location, option_settings)
        except Exception as ex:
            # Never fail. Just log event if any exception
            log.info('Cannot dump environment option settings before termination, because '.\
                     format(misc.to_unicode(ex)))
            option_settings = None
        else:
            log.info(SaveConfigurationSettingOpMessage.Succeed.format(location))
            prompt.info(SaveConfigurationSettingOpMessage.Succeed.format(location))
                   
        ret_result = OperationResult(self,
                                     None, 
                                     None,
                                     option_settings)
        return ret_result
예제 #2
0
    def execute(self, parameter_pool):
        create_eb_local_dir()

        app_name = parameter_pool.get_value(ParameterName.ApplicationName)
        env_name = parameter_pool.get_value(ParameterName.EnvironmentName)
        location = parameter_pool.get_value(ParameterName.OptionSettingFile)            

        prompt.action(SaveConfigurationSettingOpMessage.Start.format(env_name))
        
        try:
            option_settings = api_wrapper.retrieve_configuration_settings(parameter_pool,
                                                                          app_name,
                                                                          env_name)
            config_file.save_env_option_setting_file(location, option_settings)
        except Exception as ex:
            # Never fail. Just log event if any exception
            log.info(u'Cannot dump environment option settings before termination, because '.\
                     format(misc.to_unicode(ex)))
            option_settings = None
        else:
            log.info(SaveConfigurationSettingOpMessage.Succeed.format(location))
            prompt.info(SaveConfigurationSettingOpMessage.Succeed.format(location))
                   
        ret_result = OperationResult(self,
                                     None, 
                                     None,
                                     option_settings)
        return ret_result
예제 #3
0
def is_rds_delete_to_snapshot(parameter_pool, app_name, env_name):
    policy_option = OptionSepcification(RdsDefault.Namespace, 
                                          RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy])
    policy_setting = api_wrapper.retrieve_configuration_settings(parameter_pool, app_name,
                                                                 env_name = env_name, 
                                                                 options = [policy_option])

    if len(policy_setting) != 1:
        return None # Option name not found. No RDS instance
    return RdsDefault.del_policy_to_bool(policy_setting[0].value) 
예제 #4
0
def is_rds_delete_to_snapshot(parameter_pool, app_name, env_name):
    policy_options = {RdsDefault.Namespace: {RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy]}}
    try:
        policy_setting = api_wrapper.retrieve_configuration_settings(parameter_pool, app_name,
                                                                     env_name = env_name, 
                                                                     options = policy_options)
    except InvalidParameterValueException:
        return None  # Environment not exist. No RDS instance        

    if len(policy_setting) < 1:
        return None # Option name not found. No RDS instance
   
    return RdsDefault.del_policy_to_bool(policy_setting[RdsDefault.Namespace]\
                                         [RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy]]) 
예제 #5
0
def is_rds_delete_to_snapshot(parameter_pool, app_name, env_name):
    policy_option = OptionSepcification(RdsDefault.Namespace, 
                                          RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy])
    try:
        policy_setting = api_wrapper.retrieve_configuration_settings(parameter_pool, app_name,
                                                                     env_name = env_name, 
                                                                     options = [policy_option])
    except InvalidParameterValueException:
        return None  # Environment not exist. No RDS instance        

    if len(policy_setting) != 1:
        return None # Option name not found. No RDS instance
   
    return RdsDefault.del_policy_to_bool(policy_setting[0].value) 
예제 #6
0
def is_rds_delete_to_snapshot(parameter_pool, app_name, env_name):
    policy_options = {RdsDefault.Namespace: {RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy]}}
    try:
        policy_setting = api_wrapper.retrieve_configuration_settings(parameter_pool, app_name,
                                                                     env_name = env_name, 
                                                                     options = policy_options)
    except InvalidParameterValueException:
        return None  # Environment not exist. No RDS instance        

    if RdsDefault.Namespace in policy_setting\
        and RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy] in policy_setting[RdsDefault.Namespace]:
        return RdsDefault.del_policy_to_bool(policy_setting[RdsDefault.Namespace]\
                                             [RdsDefault.OptionNames[ParameterName.RdsDeletionPolicy]])
    else: 
        return None 
예제 #7
0
    def execute(self, parameter_pool):
        create_eb_local_dir()

        app_name = parameter_pool.get_value(ParameterName.ApplicationName)
        env_name = parameter_pool.get_value(ParameterName.EnvironmentName)
        location = parameter_pool.get_value(ParameterName.OptionSettingFile)            

        prompt.action(SaveConfigurationSettingOpMessage.Start.format(env_name))
        
        option_settings = api_wrapper.retrieve_configuration_settings(parameter_pool,
                                                                      app_name,
                                                                      env_name)
        config_file.save_env_option_setting_file(location, option_settings)
           
        log.info(SaveConfigurationSettingOpMessage.Succeed.format(location))           
        prompt.info(SaveConfigurationSettingOpMessage.Succeed.format(location))
                   
        ret_result = OperationResult(self,
                                     None, 
                                     None,
                                     option_settings)
        return ret_result