ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
814 stars 1.49k forks source link

gitlab_project: 'dict object' has no attribute 'project' with --check mode #5689

Open staehler opened 1 year ago

staehler commented 1 year ago

Summary

When I run my task with gitlab_project module in --check mode, there is no 'project' dictionary available. That's all what I'll get back from the module:

TASK [gitlab_projects : debug] ****************************************************************************************************************************************************************************
ok: [localhost] => 
  gitlab_project_result:
    changed: true
    failed: false
    msg: Successfully created or updated the project 

Issue Type

Bug Report

Component Name

gitlab_project

Ansible Version

$ ansible --version
ansible [core 2.12.10]
  config file = /home/ansible.cfg
  configured module search path = ['/home/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/venv/lib/python3.8/site-packages/ansible
  ansible collection location = /home/collections
  executable location = /home/venv/bin/ansible
  python version = 3.8.13 (default, Jun 14 2022, 17:49:07) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

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

Collection        Version
----------------- -------
community.general 4.8.3  

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL 8

Steps to Reproduce

  - name: create project
  community.general.gitlab_project:
    api_url: "https://{{ gitlab_api_url }}"
    validate_certs: True
    api_token: "{{ gitlab_api_token }}"
    name: "{{ gitlab_project.project_name }}"
    group: "test"
    state: present
  register: result
- debug:
    var: debug
  1. run this task with --check (no project dictionary)
  2. run this task without --check (project dictionary available)

Expected Results

  result:
    changed: true
    failed: false
    msg: Successfully created or updated the project 0200-ops_splunk_support-splunk
    project:
      _links:
        cluster_agents: https://host/api/v4/projects/123/cluster_agents
        events: https://host/api/v4/projects/123/events
        issues: https://host/api/v4/projects/123/issues
...
      allow_merge_on_skipped_pipeline: null
      analytics_access_level: enabled
      archived: false
...

### Actual Results

```console (paste below)
TASK [gitlab_projects : debug] ****************************************************************************************************************************************************************************
ok: [localhost] => 
  gitlab_project_result:
    changed: true
    failed: false
    msg: Successfully created or updated the project

Code of Conduct

ansibullbot commented 1 year ago

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 commented 1 year ago

cc @Lunik @Shaps @dj-wasabi @lgatellier @marwatk @metanovii @nejch @scodeman @sh0shin @suukit @waheedi @zanssa click here for bot help