def delete(self, params): """To delete some tasks: fuel task delete --task-id 1,2,3 To delete some tasks forcefully (without considering their state): fuel task delete -f --tid 1,6 """ tasks = Task.get_by_ids(params.task) delete_response = map(lambda task: task.delete(force=params.force), tasks) self.serializer.print_to_output( delete_response, "Tasks with id's {0} deleted.".format(', '.join( map(str, params.task))))
def list(self, params): """To display all tasks: fuel task To display tasks with some ids: fuel task --tid 1,2,3 """ acceptable_keys = ("id", "status", "name", "cluster", "progress", "uuid") if params.task: tasks_data = map(Task.get_fresh_data, Task.get_by_ids(params.task)) else: tasks_data = Task.get_all_data() self.serializer.print_to_output( tasks_data, format_table(tasks_data, acceptable_keys=acceptable_keys))
def delete(self, params): """To delete some tasks: fuel task --delete --task-id 1,2,3 To delete some tasks forcefully (without considering their state): fuel task --delete -f --tid 1,6 """ tasks = Task.get_by_ids(params.task) delete_response = map( lambda task: task.delete(force=params.force), tasks ) self.serializer.print_to_output( delete_response, "Tasks with id's {0} deleted." .format(', '.join(map(str, params.task))) )
def list(self, params): """To display all tasks: fuel task To display tasks with some ids: fuel task --tid 1,2,3 """ acceptable_keys = ("id", "status", "name", "cluster", "progress", "uuid") if params.task: tasks_data = map( Task.get_fresh_data, Task.get_by_ids(params.task) ) else: tasks_data = Task.get_all_data() self.serializer.print_to_output( tasks_data, format_table(tasks_data, acceptable_keys=acceptable_keys) )