Repository: ansible-collections/community.general

Issue:
community.general.ipa_sudorule fails when cmdgroup is specified in the task.
### Summary

Multiple scenarios were tested:
- An empty list value for cmdgroup
- A single entry for cmdgroup
- A list for cmdgroup

All scenarios resulted in:
`msg": "response sudorule_add_allow_command_group: unknown command 'sudorule_add_allow_command_group` 

Once `cmdgroup` was removed from the task definition, ipa_sudorule then executes successfully.

### Issue Type

Bug Report

### Component Name

community.general.ipa_sudorule

### Ansible Version

```console (paste below)
$ ansible --version
ansible 2.9.18
```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed
# no changes
```


### OS / Environment

CentOS 7.9

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
    - name: "PLAYBOOK:{{ playbook_name }}  ROLE:{{ ansible_role_name }}\tEnsure sudo rules are present"
      community.general.ipa_sudorule:
        name: "{{ item.key }}"
        hostcategory: all
        runasusercategory: all
        runasgroupcategory: all
        sudoopt: "{{ item.value.sudo_opts }}"
        usergroup:
          - privileged_users
        #cmdgroup: "{{ item.value.command_groups }}"
        #cmdgroup:
          #- hbase_commands
        ipa_user: admin
        ipa_pass: "xxxx"
        ipa_host: "ipa.test.net"
      loop: "{{ lookup('dict', ipa_sudo_rules) }}"

```


### Expected Results

Expected successful Ansible run with sudo rules defined in IPA with the specified sudo command groups as part of those sudo rules. 

### Actual Results

```console (paste below)
msg": "response sudorule_add_allow_command_group: unknown command 'sudorule_add_allow_command_group
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
None

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
!component =plugins/modules/identity/ipa/ipa_sudorule.py
Files identified in the description:
* [`plugins/modules/identity/ipa/ipa_sudorule.py`](https://github.com/ansible-collections/community.general/blob/master/plugins/modules/identity/ipa/ipa_sudorule.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Akasurde @Nosmoht @fxfitz @justchris1
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Hello, I was about to create a new bug request for this, but find this one, so I'm here.

Juste to say that the only thing to change to fix this bug is to change the line 226 in ipa_sudorule.py from this :
`226         return self._post_json(method='sudorule_add_allow_command_group', name=name, item={'sudocmdgroup': item})`
to this :
`226         return self._post_json(method='sudorule_add_allow_command', name=name, item={'sudocmdgroup': item})`

Then it's working correctly :)
Thanks @ahambrick and @TizeN85 for spotting this. If you would like to write a PR for fixing this bug, we would be more than happy to review it.

Resolving patch:
diff --git a/plugins/modules/identity/ipa/ipa_sudorule.py b/plugins/modules/identity/ipa/ipa_sudorule.py
--- a/plugins/modules/identity/ipa/ipa_sudorule.py
+++ b/plugins/modules/identity/ipa/ipa_sudorule.py
@@ -237,7 +237,7 @@ def sudorule_add_allow_command(self, name, item):
         return self._post_json(method='sudorule_add_allow_command', name=name, item={'sudocmd': item})
 
     def sudorule_add_allow_command_group(self, name, item):
-        return self._post_json(method='sudorule_add_allow_command_group', name=name, item={'sudocmdgroup': item})
+        return self._post_json(method='sudorule_add_allow_command', name=name, item={'sudocmdgroup': item})
 
     def sudorule_remove_allow_command(self, name, item):
         return self._post_json(method='sudorule_remove_allow_command', name=name, item=item)


Test patch: