def execute(self, parameter_pool): command = parameter_pool.get_value(PName.Command, False) if command == CommandType.DELETE: # Remove RDS master password from crential file credential_file_loc = config_file.default_aws_credential_file_location() # default environment env_name = parameter_pool.get_value(PName.EnvironmentName, False) param_list = [rds_utils.password_key_name(env_name)] # branch environment if parameter_pool.get_value(PName.Branches) is not None: branches = parameter_pool.get_value(PName.Branches, False) for branch in branches.values(): env_name = branch[PName.EnvironmentName] param_list.append(rds_utils.password_key_name(env_name)) # Remove passwords config_file.trim_aws_credential_file(credential_file_loc, param_list, True) ret_result = OperationResult(self, None, None, None) return ret_result
def execute(self, parameter_pool): eb_client = ElasticBeanstalkClient( parameter_pool.get_value(ParameterName.AwsAccessKeyId), parameter_pool.get_value(ParameterName.AwsSecretAccessKey), parameter_pool.get_value(ParameterName.ServiceEndpoint)) app_name = parameter_pool.get_value(ParameterName.ApplicationName) env_name = parameter_pool.get_value(ParameterName.EnvironmentName) prompt.action(DeleteApplicationOpMessage.Start.format(app_name)) try: response = eb_client.delete_application(app_name, 'true') except OperationInProgressException: log.info('Deleting Application "{0}" already in progress'.format( app_name)) prompt.result( DeleteApplicationOpMessage.AlreadyDelete.format(app_name)) ret_result = OperationResult( self, None, DeleteApplicationOpMessage.AlreadyDelete.format(app_name), None) else: log.info('Received response for DeleteApplication call.') self._log_api_result(self.__class__.__name__, 'DeleteApplication', response.result) prompt.result(DeleteApplicationOpMessage.Succeed.format(app_name)) credential_file_loc = config_file.default_aws_credential_file_location( ) param_list = [rds_utils.password_key_name(env_name)] config_file.trim_aws_credential_file(credential_file_loc, parameter_pool, param_list, True) ret_result = OperationResult( self, response.request_id, DeleteApplicationOpMessage.Succeed.format(app_name), response.result) return ret_result
def execute(self, parameter_pool): eb_client = ElasticBeanstalkClient(parameter_pool.get_value(ParameterName.AwsAccessKeyId), parameter_pool.get_value(ParameterName.AwsSecretAccessKey), parameter_pool.get_value(ParameterName.ServiceEndpoint)) app_name = parameter_pool.get_value(ParameterName.ApplicationName) env_name = parameter_pool.get_value(ParameterName.EnvironmentName) prompt.action(DeleteApplicationOpMessage.Start.format(app_name)) try: response = eb_client.delete_application(app_name, 'true') except OperationInProgressException: log.info('Deleting Application "{0}" already in progress'.format(app_name)) prompt.result(DeleteApplicationOpMessage.AlreadyDelete.format(app_name)) ret_result = OperationResult(self, None, DeleteApplicationOpMessage.AlreadyDelete.format(app_name), None) else: log.info('Received response for DeleteApplication call.') self._log_api_result(self.__class__.__name__, 'DeleteApplication', response.result) prompt.result(DeleteApplicationOpMessage.Succeed.format(app_name)) credential_file_loc = config_file.default_aws_credential_file_location() param_list = [rds_utils.password_key_name(env_name)] config_file.trim_aws_credential_file(credential_file_loc, parameter_pool, param_list, True) ret_result = OperationResult(self, response.request_id, DeleteApplicationOpMessage.Succeed.format(app_name), response.result) return ret_result