def get_action_statuses_by_names(action_names): action_names = set(action_names) actions = [] for action in list_action_status(): if action.name in action_names: action_names.remove(action.name) actions.append(action) if action_names: raise exceptions.NotFoundException( "Action(s) with name(s) %s not found" % (", ".join(action_names))) return actions
def get_action(action_name): """Get action by name. :returns: Action -- action object :raises: fuel_ccp.exceptions.NotFoundException """ for action in list_actions(): if action_name == action.name: return action raise exceptions.NotFoundException("Action with name '%s' not found" % (action_name))
def delete_action(action_names): """Delete action. :raises: fuel_ccp.exceptions.NotFoundException """ not_removed = [] configmap_not_removed = [] for action_name in action_names: action_status = ActionStatus.delete(action_name) if not action_status.get('action_status'): not_removed.append(action_name) if not action_status.get('configmap_status'): configmap_not_removed.append(action_name) if not_removed: raise exceptions.NotFoundException( 'The following actions were not removed: %s' % ','.join(not_removed)) if configmap_not_removed: raise exceptions.NotFoundException( 'Configmaps for the following actions were not removed: %s' % ','.join(configmap_not_removed))
def get_action_status_by_name(action_name): for action in list_action_status(): if action.name == action_name: return action raise exceptions.NotFoundException("Action with name \"%s\" not found" % (action_name))