Bug 1654356 - No way to unset a property via introspection rules
Summary: No way to unset a property via introspection rules
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-ironic-inspector
Version: 14.0 (Rocky)
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: z1
: 14.0 (Rocky)
Assignee: Iury Gregory Melo Ferreira
QA Contact: mlammon
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-28 15:13 UTC by Dmitry Tantsur
Modified: 2019-03-18 12:56 UTC (History)
4 users (show)

Fixed In Version: openstack-ironic-inspector-8.0.2-0.20181219092843.9b6133b.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-03-18 12:56:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack Storyboard 2004546 0 None None None 2018-12-05 09:24:13 UTC
OpenStack gerrit 622898 0 None None None 2018-12-05 09:23:31 UTC
OpenStack gerrit 624397 0 None None None 2018-12-11 14:17:07 UTC
Red Hat Product Errata RHBA-2019:0587 0 None None None 2019-03-18 12:56:48 UTC

Description Dmitry Tantsur 2018-11-28 15:13:01 UTC
It is possible to set a value, but not unset it. We could set it to None, but None fails validation:

 $ openstack baremetal introspection rule import introspection-rules.json 
 Invalid parameters for action set-attribute: missing required parameter(s): value

We should accept None as a valid value (distinguishing it from a missing value).

Comment 1 Dmitry Tantsur 2018-11-28 15:14:04 UTC
An example of what should work:

$ cat introspection-rules.json 
[
  {
    "actions": [
      {"action": "set-attribute", "path": "/properties/cpus", "value": null},
      {"action": "set-attribute", "path": "/properties/memory_mb", "value": null}
    ]
  }
]

Comment 6 mlammon 2019-03-12 16:35:12 UTC
Environment:

(undercloud) [stack@undercloud-0 ~]$ cat core_puddle_version
2019-03-06.1(undercloud) [stack@undercloud-0 ~]$ yum info openstack-ironic-inspector
Loaded plugins: search-disabled-repos
Available Packages
Name        : openstack-ironic-inspector
Arch        : noarch
Version     : 8.0.2
Release     : 0.20181219092843.9b6133b.el7ost
Size        : 191 k
Repo        : rhelosp-14.0-puddle/x86_64
Summary     : Hardware introspection service for OpenStack Ironic


(undercloud) [stack@undercloud-0 ~]$ cat rules.json
[
  {
    "actions": [
      {"action": "set-attribute", "path": "/properties/cpus", "value": null},
      {"action": "set-attribute", "path": "/properties/memory_mb", "value": null}
    ]
  }
]

(undercloud) [stack@undercloud-0 ~]$ openstack baremetal introspection rule import rules.json
+--------------------------------------+-------------+
| UUID                                 | Description |
+--------------------------------------+-------------+
| e4c73ab0-1b0c-42c4-852e-1fc400611821 | None        |
+--------------------------------------+-------------+

(undercloud) [stack@undercloud-0 ~]$ openstack baremetal introspection rule show e4c73ab0-1b0c-42c4-852e-1fc400611821
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field       | Value                                                                                                                                                           |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| actions     | [{u'action': u'set-attribute', u'path': u'/properties/cpus', u'value': None}, {u'action': u'set-attribute', u'path': u'/properties/memory_mb', u'value': None}] |
| conditions  | []                                                                                                                                                              |
| description | None                                                                                                                                                            |
| uuid        | e4c73ab0-1b0c-42c4-852e-1fc400611821                                                                                                                            |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+

Comment 8 errata-xmlrpc 2019-03-18 12:56:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0587


Note You need to log in before you can comment on or make changes to this bug.