Bug 1434553 - Policy conditions based on 'VM and Instance.vLANs' field not working
Summary: Policy conditions based on 'VM and Instance.vLANs' field not working
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Control
Version: 5.7.0
Hardware: All
OS: All
medium
medium
Target Milestone: GA
: 5.8.0
Assignee: Lucy Fu
QA Contact: Dmitry Misharov
URL:
Whiteboard: control:policy:condition
Depends On:
Blocks: 1437146
TreeView+ depends on / blocked
 
Reported: 2017-03-21 17:38 UTC by Ryan Spagnola
Modified: 2020-07-16 09:19 UTC (History)
4 users (show)

Fixed In Version: 5.8.0.8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1437146 (view as bug list)
Environment:
Last Closed: 2017-05-31 14:43:19 UTC
Category: Bug
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1367 0 normal SHIPPED_LIVE Moderate: CFME 5.8.0 security, bug, and enhancement update 2017-05-31 18:16:03 UTC

Description Ryan Spagnola 2017-03-21 17:38:06 UTC
Description of problem:
Using ‘VM and Instance.vLANs.name' or ‘VM and Instance.vLANs.uid_ems' do not work, they always evaluate to 'false' regardless of the criteria. Below is an example


Version-Release number of selected component (if applicable):
CF 4.2


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Example condition: 
==============
( VM and Instance : Name = "gk-cfci-03" AND VM and Instance.vLANs : Uid Ems CONTAINS "dvportgroup-36" AND VM and Instance.vLANs : Name CONTAINS "602-vd-OOB_MGMT" )

Policy simulation result for VM named 'gk-cfci-03':
=================================
- VM and Instance: Name = 'go-cfci-03'  returns 'true'
- VM and Instance.vLANs : Uid Ems CONTAINS "dvportgroup-36"  returns 'false'
- VM and Instance.vLANs : Name CONTAINS "602-vd-OOB_MGMT" returns 'false'

Rails Console listing of 'gk-cfci-03's LANs:
==========================
irb(main):012:0> Vm.find_by(name: 'gk-cfci-03', active: true).lans.each{|lan| pp lan};0
#<Lan:0x0000000a204388
 id: 10000000000645,
 switch_id: 10000000000003,
 name: "602-vd-OOB_MGMT",
 tag: "",
 created_on: Tue, 28 Feb 2017 17:59:44 UTC +00:00,
 updated_on: Tue, 28 Feb 2017 17:59:44 UTC +00:00,
 uid_ems: "dvportgroup-36",
 allow_promiscuous: false,
 forged_transmits: false,
 mac_changes: false,
 computed_allow_promiscuous: nil,
 computed_forged_transmits: nil,
 computed_mac_changes: nil>
#<Lan:0x0000000a20fa08
 id: 10000000000645,
 switch_id: 10000000000003,
 name: "602-vd-OOB_MGMT",
 tag: "",
 created_on: Tue, 28 Feb 2017 17:59:44 UTC +00:00,
 updated_on: Tue, 28 Feb 2017 17:59:44 UTC +00:00,
 uid_ems: "dvportgroup-36",
 allow_promiscuous: false,
 forged_transmits: false,
 mac_changes: false,
 computed_allow_promiscuous: nil,
 computed_forged_transmits: nil,
 computed_mac_changes: nil>
=> 0

Comment 5 CFME Bot 2017-03-28 14:06:38 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/b3c3ea9451d0543ca02a3c322a6cc90005a5710e

commit b3c3ea9451d0543ca02a3c322a6cc90005a5710e
Author:     Lucy Fu <lufu>
AuthorDate: Thu Mar 23 15:16:51 2017 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Mar 28 09:31:45 2017 -0400

    Fix an issue in Condition where fields of virtual associations can't be evaluated.
    
    Virtual associations are not checked when navigating down the relationships.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1434553

 lib/extensions/ar_taggable.rb           | 2 +-
 spec/lib/extensions/ar_taggable_spec.rb | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comment 7 Dmitry Misharov 2017-04-11 07:31:04 UTC
Verified in 5.8.0.9-alpha2.20170404195944_1d7ece4. "VM and Instance.vLANs.name" and "VM and Instance.vLANs.uid_ems" criterias work as expected.

Comment 9 errata-xmlrpc 2017-05-31 14:43:19 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/RHSA-2017:1367


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