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

'ConsistencyLevel' is not defined #293

Open
discostur opened this issue Mar 12, 2025 · 3 comments
Open

'ConsistencyLevel' is not defined #293

discostur opened this issue Mar 12, 2025 · 3 comments
Labels
bug This issue/PR relates to a bug.

Comments

@discostur
Copy link

SUMMARY
"module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1741796454.1483688-98476-197926412226588/AnsiballZ_cassandra_role.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1741796454.1483688-98476-197926412226588/AnsiballZ_cassandra_role.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1741796454.1483688-98476-197926412226588/AnsiballZ_cassandra_role.py\", line 47, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.community.cassandra.plugins.modules.cassandra_role', init_globals=dict(_module_fqn='ansible_collections.community.cassandra.plugins.modules.cassandra_role', _modlib_path=modlib_path),\r\n  File \"<frozen runpy>\", line 226, in run_module\r\n  File \"<frozen runpy>\", line 98, in _run_module_code\r\n  File \"<frozen runpy>\", line 88, in _run_code\r\n  File \"/tmp/ansible_community.cassandra.cassandra_role_payload_z_lrpdhn/ansible_community.cassandra.cassandra_role_payload.zip/ansible_collections/community/cassandra/plugins/modules/cassandra_role.py\", line 880, in <module>\r\n  File \"/tmp/ansible_community.cassandra.cassandra_role_payload_z_lrpdhn/ansible_community.cassandra.cassandra_role_payload.zip/ansible_collections/community/cassandra/plugins/modules/cassandra_role.py\", line 639, in main\r\nNameError: name 'ConsistencyLevel' is not defined. Did you mean: 'consistency_level'?\r\n", "msg": "MODULE FAILURE: No start of json char found\nSee stdout/stderr for the exact error", "rc": 1}

Cassandra Version: 5.0.3
community.cassandra version: 1.4.0
OS: ubuntu 24.04
ansible [core 2.18.3]

I just tried to setup a new user but it failed with the error above. Ansible code looks like this:

  tasks:
    - name: Create user zoneFileIngestion
      community.cassandra.cassandra_role:
        name: user
        password: "{{ cassandra_user_password }}"
        update_password: true
        state: present
        login: yes
        login_user: cassandra
        login_password: "{{ cassandra_superuser_password}}"
        consistency_level: LOCAL_ONE
        permissions:
          testkeyspace:
            - "ALL PERMISSIONS"

I tried to set consistency_level explicit or don't set it (so use default), but nothing works for me.

Regards,
Kilian

@rhysmeister
Copy link
Collaborator

What's the version of the cassandra Python driver you have installed?

@discostur
Copy link
Author

@rhysmeister to be honest i didn't know that i have to install the driver first ... didn't read that step in the documentation :/

anyway, it works now; thanks for your help ;)

python3 -m venv venv-cassandra
source venv-cassandra/bin/activate
python3 -m pip install cassandra-driver

-> set python interpretor in ansible, for example:

  vars:
    ansible_python_interpreter: /path_to_venv/venv-cassandra/bin/python

@rhysmeister
Copy link
Collaborator

Hi @discostur, I'll reopen this as a bug. This can be handled much better than it is now. We should at least make it more ob
vious what the problem is.

Cheers,

Rhys

@rhysmeister rhysmeister reopened this Mar 13, 2025
@rhysmeister rhysmeister added the bug This issue/PR relates to a bug. label Mar 13, 2025
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.
Projects
None yet
Development

No branches or pull requests

2 participants