use 'auto' instead of None
In cli cmds:watcher audit create,
the Strategy is None if no --strategy
It's better to use default instead of None
watcher audit create -g thermal_optimization
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| UUID | 2bc3001d-683a-48ee-b2f2-766cb8d6329e |
| Created At | 2016-12-22T08:41:21.173601+00:00 |
| Updated At | None |
| Deleted At | None |
| State | PENDING |
| Audit Type | ONESHOT |
| Parameters | {} |
| Interval | None |
| Goal | thermal_optimization |
| Strategy | None |
| Audit Scope | [] |
+-------------+--------------------------------------+
Change-Id: I5798df81303c425ed0e26e401589e6680b945bf6
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user