Bug 1654356

Summary: No way to unset a property via introspection rules
Product: Red Hat OpenStack Reporter: Dmitry Tantsur <dtantsur>
Component: openstack-ironic-inspectorAssignee: Iury Gregory Melo Ferreira <imelofer>
Status: CLOSED ERRATA QA Contact: mlammon
Severity: low Docs Contact:
Priority: low    
Version: 14.0 (Rocky)CC: bfournie, imelofer, mburns, slinaber
Target Milestone: z1Keywords: Triaged, ZStream
Target Release: 14.0 (Rocky)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-ironic-inspector-8.0.2-0.20181219092843.9b6133b.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-18 12:56:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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