diff --git a/watcherclient/tests/v1/test_audit_shell.py b/watcherclient/tests/v1/test_audit_shell.py index 5b83eb2..43e24d2 100644 --- a/watcherclient/tests/v1/test_audit_shell.py +++ b/watcherclient/tests/v1/test_audit_shell.py @@ -78,7 +78,7 @@ AUDIT_2 = { 'audit_template_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2', 'audit_template_name': 'at1', 'goal_name': 'fc087747-61be-4aad-8126-b701731ae836', - 'strategy_name': None, + 'strategy_name': 'auto', 'created_at': datetime.datetime.now().isoformat(), 'updated_at': None, 'deleted_at': None, @@ -94,7 +94,7 @@ AUDIT_3 = { 'audit_template_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2', 'audit_template_name': 'at1', 'goal_name': None, - 'strategy_name': None, + 'strategy_name': 'auto', 'created_at': datetime.datetime.now().isoformat(), 'updated_at': None, 'deleted_at': None, diff --git a/watcherclient/v1/audit_shell.py b/watcherclient/v1/audit_shell.py index 3767e84..76bbc67 100644 --- a/watcherclient/v1/audit_shell.py +++ b/watcherclient/v1/audit_shell.py @@ -41,6 +41,8 @@ class ShowAudit(command.ShowOne): try: audit = client.audit.get(parsed_args.audit) + if audit.strategy_name is None: + audit.strategy_name = 'auto' except exceptions.HTTPNotFound as exc: raise exceptions.CommandError(str(exc)) @@ -115,6 +117,9 @@ class ListAudit(command.Lister): try: data = client.audit.list(**params) + for audit in data: + if audit.strategy_name is None: + audit.strategy_name = 'auto' except exceptions.HTTPNotFound as ex: raise exceptions.CommandError(str(ex)) @@ -189,6 +194,8 @@ class CreateAudit(command.ShowOne): fields['strategy']).uuid audit = client.audit.create(**fields) + if audit.strategy_name is None: + audit.strategy_name = 'auto' columns = res_fields.AUDIT_FIELDS column_headers = res_fields.AUDIT_FIELD_LABELS