diff --git a/mistralclient/commands/v2/action_executions.py b/mistralclient/commands/v2/action_executions.py index 7dea2cd8..e45cb19c 100644 --- a/mistralclient/commands/v2/action_executions.py +++ b/mistralclient/commands/v2/action_executions.py @@ -26,10 +26,33 @@ LOG = logging.getLogger(__name__) def format_list(action_ex=None): - return format(action_ex, lister=True) + columns = ( + 'ID', + 'Name', + 'Workflow name', + 'Task name', + 'Task ID', + 'State', + 'Accepted', + ) + + if action_ex: + data = ( + action_ex.id, + action_ex.name, + action_ex.workflow_name, + action_ex.task_name if hasattr(action_ex, 'task_name') else None, + action_ex.task_execution_id, + action_ex.state, + action_ex.accepted, + ) + else: + data = (tuple('' for _ in range(len(columns))),) + + return columns, data -def format(action_ex=None, lister=False): +def format(action_ex=None): columns = ( 'ID', 'Name', @@ -42,11 +65,6 @@ def format(action_ex=None, lister=False): ) if action_ex: - state_info = ( - action_ex.state_info if not lister - else base.cut(action_ex.state_info) - ) - data = ( action_ex.id, action_ex.name, @@ -54,7 +72,7 @@ def format(action_ex=None, lister=False): action_ex.task_name if hasattr(action_ex, 'task_name') else None, action_ex.task_execution_id, action_ex.state, - state_info, + action_ex.state_info, action_ex.accepted, ) else: diff --git a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py index e8076a21..28867af5 100644 --- a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py +++ b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py @@ -93,7 +93,7 @@ class SimpleMistralCLITests(base.MistralCLIAuth): self.mistral('action-execution-list')) self.assertTableStruct( act_execs, - ['ID', 'Name', 'Workflow name', 'State', 'State info', 'Accepted'] + ['ID', 'Name', 'Workflow name', 'State', 'Accepted'] ) diff --git a/mistralclient/tests/unit/v2/test_cli_action_execs.py b/mistralclient/tests/unit/v2/test_cli_action_execs.py index a1304623..6872f03c 100644 --- a/mistralclient/tests/unit/v2/test_cli_action_execs.py +++ b/mistralclient/tests/unit/v2/test_cli_action_execs.py @@ -105,8 +105,7 @@ class TestCLIActionExecutions(base.BaseCommandTest): result = self.call(action_ex_cmd.List) self.assertEqual( - [('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', - 'RUNNING somehow.', True)], + [('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', True)], result[1] )