Bug 1976926

Summary: [ansible-freeipa] Required correct error message for removing in/ex/clusive regex with an invalid key from automember rule
Product: Red Hat Enterprise Linux 8 Reporter: Varun Mylaraiah <mvarun>
Component: ansible-freeipaAssignee: Thomas Woerner <twoerner>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: amore
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ansible-freeipa-0.3.7-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1981713 (view as bug list) Environment:
Last Closed: 2021-11-09 18:45:36 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:
Bug Depends On:    
Bug Blocks: 1981713    

Description Varun Mylaraiah 2021-06-28 15:02:13 UTC
Description of problem:
Required correct error message while removing in/ex/clusive regex with an invalid key from automember rule

Version-Release number of selected component (if applicable):
ansible-freeipa-0.3.6-3.el8.noarch


Steps to Reproduce:
[root@ansible ~]# cat automember3_remove.yaml
---
- name: Playbook to ensure group automember is not able to remove with invalid exclusive regex key
  hosts: ipaserver
  become: yes
  
  tasks:
  - ipaautomember:      
      ipaadmin_principal: admin
      Ipaadmin_password: <xxxxxxxxx>
      name: 01automemb_usergroup
      exclusive:
        - key: tesykey
          expression: '^uid=clint'
      action: member
      automember_type: group
      state: absent


[root@ansible ~]# ansible-playbook -vv -i inventory/automember.hosts 
PLAYBOOK: automember3_remove.yaml *****************************************************************************************
1 plays in automember3_remove.yaml

PLAY [Playbook to ensure group automember is not able to remove with invalid exclusive regex key] *************************

TASK [Gathering Facts] ****************************************************************************************************
task path: /root/automember3_remove.yaml:2
ok: [master.ipadomain.test]
META: ran handlers

TASK [ipaautomember] ******************************************************************************************************
task path: /root/automember3_remove.yaml:7
fatal: [master.ipadomain.test]: FAILED! => {"changed": false, "msg": "too many values to unpack (expected 2)"}

PLAY RECAP ****************************************************************************************************************
master.ipadomain.test      : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

Actual results:
FAILED! => {"changed": false, "msg": "too many values to unpack (expected 2)"}

Expected results:
tesykey is not a valid attribute.

Additional info:

Comment 1 Thomas Woerner 2021-07-08 19:44:21 UTC
Upstream PR: https://github.com/freeipa/ansible-freeipa/pull/590

Comment 2 Thomas Woerner 2021-07-12 12:24:47 UTC
The upstream PR has been merged.

Comment 3 Thomas Woerner 2021-07-13 13:12:56 UTC
Here is an additional PR to verify condition keys: https://github.com/freeipa/ansible-freeipa/pull/596

Comment 9 anuja 2021-07-30 12:23:25 UTC
Verified using nightly:
(A) test-result.txt.gz
2021-07-30T12:16:22 ansible_freeipa_tests/automember/test_automember.py::TestAutomember::test_automember_group_rule_remove_with_invalid_exclusive_regex_key PASSED [ 80%]

(B) runner.log 
2021-07-30T12:06:58 ok: [ansible.runner.test] => (item=ansible-freeipa) => 
2021-07-30T12:06:58   msg:
2021-07-30T12:06:58   - arch: noarch
2021-07-30T12:06:58     epoch: null
2021-07-30T12:06:58     name: ansible-freeipa
2021-07-30T12:06:58     release: 1.el8
2021-07-30T12:06:58     source: rpm
2021-07-30T12:06:58     version: 0.3.8

Comment 12 errata-xmlrpc 2021-11-09 18:45:36 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 (ansible-freeipa bug fix and enhancement update), 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-2021:4268