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

ejabberd_user: module error 'rc: 1' #5355

Closed
1 task done
eliteaz opened this issue Oct 13, 2022 · 10 comments
Closed
1 task done

ejabberd_user: module error 'rc: 1' #5355

eliteaz opened this issue Oct 13, 2022 · 10 comments
Labels
bug This issue/PR relates to a bug language module module needs_info This issue requires further information. Please answer any outstanding questions packaging plugins plugin (any type)

Comments

@eliteaz
Copy link

eliteaz commented Oct 13, 2022

Summary

Using a simple task to create ejabberd user

    - name: Create xmpp user
      community.general.ejabberd_user:
        host: "test-xmpp.org"
        username: "bot-dev"
        password: "YZSdvce93FbeRopvT5s8vPVvP"

When I create ejabberd user always get an error rc:1

failed: [tvm-prod-test-xmpp01.org] (item={'xmpp_username': 'bot-dev', 'xmpp_password': 'YZSdvce93FbeRopvT5s8vPVvP'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "xmpp_password": "YZSdvce93FbeRopvT5s8vPVvP",
        "xmpp_username": "bot-dev"
    },
    "rc": 1
}

as module require:
ejabberd configuration file include mod_admin_extra as a module.
and password also stored in clear text

Issue Type

Bug Report

Component Name

ejabberd_user

Ansible Version

$ ansible --version
ansible [core 2.12.5]
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
jinja version = 2.11.3

Community.general Version

$ ansible-galaxy collection list community.general
community.general 5.7.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

Expected Results

expect to create user for ejabberd

Actual Results

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@eliteaz eliteaz changed the title ejabberd_user rc: 1 ejabberd_user.py module error 'rc: 1' Oct 13, 2022
@ansibullbot
Copy link
Collaborator

Files identified in the description:

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

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @russoz
click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug language module module packaging plugins plugin (any type) labels Oct 13, 2022
@russoz russoz changed the title ejabberd_user.py module error 'rc: 1' ejabberd_user: module error 'rc: 1' Oct 13, 2022
@ansibullbot
Copy link
Collaborator

Files identified in the description:

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

click here for bot help

@ansibullbot
Copy link
Collaborator

@eliteaz
Copy link
Author

eliteaz commented Oct 14, 2022

I have made such a changes in a ejabberd_user module

# diff -u ejabberd_user.py /root/.ansible/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/ejabberd_user.py
--- ejabberd_user.py	2022-10-12 17:40:29.447826943 +0300
+++ /root/.ansible/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/ejabberd_user.py	2022-10-12 17:37:56.527302236 +0300
@@ -164,7 +164,7 @@
                 module.fail_json(msg=err, rc=rc)
 
     elif obj.state == 'present':
-        if not obj.exists:
+        if obj.exists:
             if module.check_mode:
                 module.exit_json(changed=True)
             (rc, out, err) = obj.create()
@@ -172,8 +172,8 @@
             if module.check_mode:
                 module.exit_json(changed=True)
             (rc, out, err) = obj.update()
-        if rc is not None and rc != 0:
-            module.fail_json(msg=err, rc=rc)
+#        if rc is not None and rc != 0:
+#            module.fail_json(msg=err, rc=rc)
 
     if rc is None:
         result['changed'] = False

and user creation works properly
so I think that module logic conditionals not working correctly.

@ansibullbot
Copy link
Collaborator

Files identified in the description:

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

click here for bot help

@nerijus
Copy link

nerijus commented Nov 7, 2022

I reported it last year - #3093 (comment)

@russoz
Copy link
Collaborator

russoz commented Jul 30, 2023

@eliteaz @nerijus please check whether the PR #7033 does the trick.

@russoz
Copy link
Collaborator

russoz commented Oct 10, 2023

@eliteaz @nerijus Could you please confirm whether the fix worked? Thanks

needs_info

@ansibullbot ansibullbot added the needs_info This issue requires further information. Please answer any outstanding questions label Oct 10, 2023
@nerijus
Copy link

nerijus commented Oct 11, 2023

Sorry for the delay, just tested - it works OK now.

@eliteaz eliteaz closed this as completed Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug language module module needs_info This issue requires further information. Please answer any outstanding questions packaging plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

4 participants