watcher-audit-list-failed

Bug #1738758 reported by Alexander Chadin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher
Fix Released
High
Unassigned

Bug Description

Request 'watcher audit list' requires to have 'name' field to be filled.
'nullable' option should be set to True: https://github.com/openstack/watcher/blob/1.6.0/watcher/objects/audit.py#L97

Otherwise, the following error raises:
Traceback (most recent call last):

  File "/usr/lib/python3.4/site-packages/wsmeext/pecan.py", line 85, in callfunction
    result = f(self, *args, **kwargs)

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 404, in get_all
    audit_uuid=audit_uuid, strategy=strategy)

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 382, in _get_action_plans_collection
    sort_dir=sort_dir)

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 307, in convert_with_links
    p, expand) for p in rpc_action_plans]

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 307, in <listcomp>
    p, expand) for p in rpc_action_plans]

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 272, in convert_with_links
    action_plan = ActionPlan(**rpc_action_plan.as_dict())

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 247, in __init__
    setattr(self, 'audit_uuid', kwargs.get('audit_id', wtypes.Unset))

  File "/opt/watcher/watcher/api/controllers/v1/action_plan.py", line 133, in _set_audit_uuid
    audit = objects.Audit.get(pecan.request.context, value)

  File "/usr/lib/python3.4/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper
    result = fn(cls, context, *args, **kwargs)

  File "/opt/watcher/watcher/objects/audit.py", line 166, in get
    return cls.get_by_id(context, audit_id, eager=eager)

  File "/usr/lib/python3.4/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper
    result = fn(cls, context, *args, **kwargs)

  File "/opt/watcher/watcher/objects/audit.py", line 187, in get_by_id
    audit = cls._from_db_object(cls(context), db_audit, eager=eager)

  File "/opt/watcher/watcher/objects/base.py", line 152, in _from_db_object
    obj[field] = db_object[field]

  File "/usr/lib/python3.4/site-packages/oslo_versionedobjects/base.py", line 777, in __setitem__
    setattr(self, name, value)

  File "/usr/lib/python3.4/site-packages/oslo_versionedobjects/base.py", line 72, in setter
    field_value = field.coerce(self, name, value)

  File "/usr/lib/python3.4/site-packages/oslo_versionedobjects/fields.py", line 193, in coerce
    return self._null(obj, attr)

  File "/usr/lib/python3.4/site-packages/oslo_versionedobjects/fields.py", line 171, in _null
    raise ValueError(_("Field `%s' cannot be None") % attr)

Changed in watcher:
importance: Undecided → High
description: updated
Revision history for this message
Hidekazu Nakamura (nakamura-h) wrote :

Newly created audit has default name if name was not given like below.
Is this report fixing for backward compatibility ?

$ watcher audit list
+--------------------------------------+-------------------------------------------+------------+-----------+------+----------+--------------+
| UUID | Name | Audit Type | State | Goal | Strategy | Auto Trigger |
+--------------------------------------+-------------------------------------------+------------+-----------+------+----------+--------------+
| 6f3ece51-9014-465d-9eb0-9eaee7ed98e1 | zone_migration-2017-12-08T04:35:47.041556 | ONESHOT | CANCELLED | None | auto | True |
| f375f7cb-3dae-4828-aa43-d450f84c24ac | zone_migration-2017-12-08T04:39:19.843336 | ONESHOT | CANCELLED | None | auto | False |
| a2ac7df8-233b-43cd-a2af-3670fcc4c3b3 | zone_migration-2017-12-08T04:42:29.760497 | ONESHOT | CANCELLED | None | auto | False |
+--------------------------------------+-------------------------------------------+------------+-----------+------+----------+--------------+

Revision history for this message
Alexander Chadin (joker946) wrote :

Hidekazu: Exactly

Revision history for this message
Hidekazu Nakamura (nakamura-h) wrote :

Alexander Chadin: Thanks, I got it.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (master)

Reviewed: https://review.openstack.org/528691
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=95548af426e823687e03fdb3abcd5fb714c96cbe
Submitter: Zuul
Branch: master

commit 95548af426e823687e03fdb3abcd5fb714c96cbe
Author: Alexander Chadin <email address hidden>
Date: Mon Dec 18 13:57:14 2017 +0300

    Fix watcher audit list command

    This patch set adds data migration version that fills noname audits
    with name like strategy.name + '-' + audit.created_at.

    Closes-Bug: #1738758
    Change-Id: I1d65b3110166e9f64ce5b80a34672d24d629807d

Changed in watcher:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher 1.7.0

This issue was fixed in the openstack/watcher 1.7.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.