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

rundeck_project not working #5742

Closed
1 task done
hille721 opened this issue Dec 30, 2022 · 4 comments · Fixed by #6300
Closed
1 task done

rundeck_project not working #5742

hille721 opened this issue Dec 30, 2022 · 4 comments · Fixed by #6300
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) traceback web_infrastructure

Comments

@hille721
Copy link

hille721 commented Dec 30, 2022

Summary

I tried to use the rundeck_project module, but it is not working? Should this still a working module? For me it looks like kind of dead, no changes in the last ~ two years.

Issue Type

Bug Report

Component Name

rundeck_project

Ansible Version

$ ansible --version
ansible [core 2.14.1]
  config file = /home/hille/gitrepos/plminfra_ansible/ansible.cfg
  configured module search path = ['/home/hille/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/hille/gitrepos/plminfra_ansible/.venv/lib/python3.9/site-packages/ansible
  ansible collection location = /home/hille/.ansible/collections:/usr/share/ansible/collections:/home/hille/server/data/ansible_collections
  executable location = /home/hille/gitrepos/plminfra_ansible/.venv/bin/ansible
  python version = 3.9.5 (default, Nov 23 2021, 15:27:38) [GCC 9.3.0] (/home/hille/gitrepos/plminfra_ansible/.venv/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 6.1.0

Configuration

No response

OS / Environment

NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Steps to Reproduce

- name: Create Rundeck project 
  community.general.rundeck_project:
    name: ProjectName
    url: "{{ rundeck_url }}"
    token: "{{ rundeck_token }}"
    state: present

Expected Results

Project will be created

Actual Results

The full traceback is:
  File "/tmp/ansible_community.general.rundeck_project_payload_mft4mzlr/ansible_community.general.rundeck_project_payload.zip/ansible_collections/community/general/plugins/modules/rundeck_project.py", line 139, in request_rundeck_api
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
fatal: [localhost]: FAILED! => changed=false 
  invocation:
    module_args:
      api_version: 41
      client_cert: null
      client_key: null
      force: false
      force_basic_auth: false
      http_agent: ansible-httpget
      name: plmops
      state: present
      token: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
      url: https://rdeckplmprod.icp.infineon.com
      url_password: null
      url_username: null
      use_gssapi: false
      use_proxy: true
      validate_certs: true
  msg: 'Rundeck response was not a valid JSON. Exception was: Expecting value: line 1 column 1 (char 0). Object was: b'''''

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@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

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) traceback web_infrastructure labels Dec 30, 2022
@hille721
Copy link
Author

Already found out that if following line https://github.com/ansible-collections/community.general/blob/main/plugins/modules/rundeck_project.py#L137 will be changed to if resp != b"":, it is running without an error. But it is still not creating a project, because of this line: https://github.com/ansible-collections/community.general/blob/main/plugins/modules/rundeck_project.py#L152. facts will be b'' not none, thus it is doing nothing.
But at least the deletion with absent is working then.

I also tried it with Python3.6 and even Python2. Same respectively another error :/

@felixfontein
Copy link
Collaborator

I would probably change line 136 to resp = resp.read() or None and line 137 to if resp:. That way the request_rundeck_api() function either returns decoded JSON or None as its first return value.

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 module module plugins plugin (any type) traceback web_infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants