Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipaconfig: Fix fail_json calls. #920

Merged
merged 1 commit into from Oct 13, 2022

Conversation

rjeffman
Copy link
Member

Ansible's fail_json() method required that the message paramater was passed with a keyword parameter, rather than a positional one. Although this seems to work with ansible-core 2.13+, it might not work with previous versions of Ansible.

This patch fixes the behaviour for all supported Ansible versions.

Copy link
Collaborator

@varunmylaraiah varunmylaraiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix.
PR works fine for me.


Console output:
[root@ansible ~]# cat config_module.yml
---
- name: Playbook to ensure not able to update netbios_name without enable_sid.
  hosts: ipaserver
 
  tasks:
  - ipaconfig:
      ipaadmin_password: <xxxxxxxx>
      netbios_name: NEWTESTNETBIOS

[root@ansible ~]# ansible-playbook -vv -i inventory/config.hosts config_module.yml
ansible-playbook 2.9.27
PLAYBOOK: config_module.yml **********************************************************************************************************
1 plays in config_module.yml

PLAY [Playbook to ensure not able to update netbios_name without enable_sid.] ********************************************************

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

TASK [ipaconfig] *********************************************************************************************************************
task path: /root/config_module.yml:6
fatal: [master.ipadomain.test]: FAILED! => {"changed": false, "msg": "'enable-sid: yes' required for 'netbios_name' and 'add-sids'."}

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

Ansible's fail_json() method required that the message paramater was
passed with a keyword parameter, rather than a positional one. Although
this seems to work with ansible-core 2.13+, it might not work with
previous versions of Ansible.

This patch fixes the behaviour for all supported Ansible versions.
Copy link
Member

@t-woerner t-woerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@t-woerner t-woerner merged commit aa4cc3b into freeipa:master Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants