Bug 918261

Summary: Some managed netgroups are not suppressed in host and hostgroup commands output
Product: Red Hat Enterprise Linux 7 Reporter: Namita Soman <nsoman>
Component: ipaAssignee: Rob Crittenden <rcritten>
Status: CLOSED CURRENTRELEASE QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.0CC: jcholast, mkosek, xdong
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-3.2.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:57:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Namita Soman 2013-03-05 19:09:40 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/3464

This is because the `suppress_netgroup_memberof` method of both `host` and `hostgroup` classes is broken - it removes values from a list while the list is being iterated, which causes some items of the list to be skipped.

Comment 1 Namita Soman 2013-03-05 19:18:11 UTC
Please add steps to verify

Comment 2 Jan Cholasta 2013-03-06 07:59:54 UTC
How to reproduce:

$ ipa host-add host.example.com

$ ipa hostgroup-add hostgroup1 --desc Test

$ ipa hostgroup-add hostgroup2 --desc Test

$ ipa hostgroup-add-member hostgroup2 --hosts host.example.com

$ ipa hostgroup-add-member hostgroup1 --hostgroups hostgroup2

$ ipa host-show host.example.com
  Host name: host.example.com
  Principal name: host/host.example.com
  Password: False
  Member of host-groups: hostgroup2
  Roles: Entitlement Compliance
  Indirect Member of netgroup: hostgroup2        # <-- this line should not be here
  Indirect Member of host-group: hostgroup1
  Keytab: True
  Managed by: host.example.com

Comment 4 Xiyang Dong 2013-08-06 18:16:34 UTC
Verified.

Version : ipa-server-3.2.2-1.el7.x86_64


Automated Test Results :

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: ipa-host-bugzilla-003: BZ918261 - Some managed netgroups are not suppressed in host and hostgroup commands output
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-------------------------------------
Added host "mytesthost1.testrelm.com"
-------------------------------------
  Host name: mytesthost1.testrelm.com
  Principal name: host/mytesthost1.testrelm.com
  Password: False
  Keytab: False
  Managed by: mytesthost1.testrelm.com
:: [ 13:42:59 ] ::  Adding new host mytesthost1.testrelm.com successful with force option.
:: [ 13:42:59 ] ::  Executing: ipa group-add --desc="mytesthostgroup1" "mytesthostgroup1"
----------------------------------
Added hostgroup "mytesthostgroup1"
----------------------------------
  Host-group: mytesthostgroup1
  Description: mytesthostgroup1
:: [ 13:43:00 ] ::  Adding new Host Group "mytesthostgroup1" successful.
:: [ 13:43:00 ] ::  Executing: ipa group-add --desc="mytesthostgroup2" "mytesthostgroup2"
----------------------------------
Added hostgroup "mytesthostgroup2"
----------------------------------
  Host-group: mytesthostgroup2
  Description: mytesthostgroup2
:: [ 13:43:02 ] ::  Adding new Host Group "mytesthostgroup2" successful.
:: [ 13:43:02 ] ::  Executing: ipa hostgroup-add-member --hosts=mytesthost1.testrelm.com "mytesthostgroup2"
  Host-group: mytesthostgroup2
  Description: mytesthostgroup2
  Member hosts: mytesthost1.testrelm.com
-------------------------
Number of members added 1
-------------------------
:: [ 13:43:03 ] ::  Adding hosts "mytesthost1.testrelm.com" to host group mytesthostgroup2 successful.
:: [   PASS   ] :: Adding host mytesthost1.testrelm.com to host group "mytesthostgroup2"
:: [ 13:43:03 ] ::  Executing: ipa hostgroup-add-member --hostgroups=mytesthostgroup2 "mytesthostgroup1"
  Host-group: mytesthostgroup1
  Description: mytesthostgroup1
  Member host-groups: mytesthostgroup2
  Indirect Member hosts: mytesthost1.testrelm.com
-------------------------
Number of members added 1
-------------------------
:: [ 13:43:06 ] ::  Adding hostgroups "mytesthostgroup2" to host group mytesthostgroup1 successful.
:: [   PASS   ] :: Adding host group mytesthostgroup2 to host group "mytesthostgroup1"
  Member of host-groups: mytesthostgroup2
:: [ 13:43:07 ] ::  Value of Member of host-groups: for mytesthost1.testrelm.com is as expected - Member of host-groups: mytesthostgroup2
:: [   PASS   ] :: Verifying host-show has correct info.
  Indirect Member of host-group: mytesthostgroup1
:: [ 13:43:08 ] ::  Value of Indirect Member of host-group: for mytesthost1.testrelm.com is as expected - Indirect Member of host-group: mytesthostgroup1
:: [   PASS   ] :: Verifying host-show has correct info.
:: [ 13:43:09 ] ::  ERROR: mytesthost1.testrelm.com verification failed: Value of Indirect Member of netgroup: - GOT:  EXPECTED: mytesthostgroup2
:: [   PASS   ] :: Verifying host-show has correct info.
---------------------------------------
Deleted host "mytesthost1.testrelm.com"
---------------------------------------
:: [ 13:43:10 ] ::  Host mytesthost1.testrelm.com deleted successfully.
------------------------------------
Deleted hostgroup "mytesthostgroup1"
------------------------------------
:: [ 13:43:12 ] ::  Host group mytesthostgroup1 deleted successfully.
------------------------------------
Deleted hostgroup "mytesthostgroup2"
------------------------------------
:: [ 13:43:13 ] ::  Host group mytesthostgroup2 deleted successfully.

Comment 5 Ludek Smid 2014-06-13 12:57:47 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.