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

content_overrides not working on activation_key module #1811

Closed
JaketheZ opened this issue Dec 12, 2024 · 1 comment
Closed

content_overrides not working on activation_key module #1811

JaketheZ opened this issue Dec 12, 2024 · 1 comment

Comments

@JaketheZ
Copy link

SUMMARY

I would like to define content_overrides but get the following Error.

TASK [Test] *************************************************************************************************************************************************************************************************************
Thursday 12 December 2024  17:20:46 +0100 (0:00:00.119)       0:00:04.424 ***** 
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error while performing content_override on activation_keys: Error while performing content_override on activation_keys: 400 Client Error: Bad Request for url: https://zdeaal10iapp031.zeiss.org/katello/api/activation_keys/40/content_override - {'displayMessage': 'Content label(s) \"Nginx\" were not found in the Organization \"CIT-OD\"', 'errors': ['Content label(s) \"Nginx\" were not found in the Organization \"CIT-OD\"']}"}
ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible [core 2.16.7]
  config file = /mnt/c/Users/ZOJOETTI/OneDrive - Carl Zeiss AG/Documents/git/Ansible/orcharhino_config/ansible.cfg
  configured module search path = ['/home/jake/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jake/ansible-env/lib/python3.11/site-packages/ansible
  ansible collection location = /home/jake/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/jake/ansible-env/bin/ansible
  python version = 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0] (/home/jake/ansible-env/bin/python3)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection                    Version
----------------------------- -------
ansible.posix                 2.0.0  
community.general             10.1.0 
fedora.linux_system_roles     1.92.1 
middleware_automation.common  1.2.2  
middleware_automation.wildfly 1.5.5  
theforeman.foreman            5.1.0  
KATELLO/FOREMAN VERSION
rubygem-katello-4.13.1-47.6.0.atix.el8.noarch
foreman-3.11.2-52.11.0.atix.el8.noarch
STEPS TO REPRODUCE

var:

foreman_activation_keys:
  - name: Test
    content_view: cv_azure_ubuntu_24_3rdParty
    lifecycle_environment: Test
    content_overrides:
      - label: Ubuntu24_nginx_stable
        override: enabled

tasks:

    - name: "Get Info"
      theforeman.foreman.content_view_info:
        username: "{{ foreman_username }}"
        password: "{{ foreman_password }}"
        server_url: "{{ foreman_server_url }}"
        validate_certs: "{{ foreman_validate_certs }}"
        organization: "{{ foreman_organization }}"
        name: "cv_azure_ubuntu_24_3rdParty"
      register: info

    - name: "Debug"
      ansible.builtin.debug:
        msg: "{{ info }}"

    - name: "Test"
      theforeman.foreman.activation_key:
        username: "{{ foreman_username }}"
        password: "{{ foreman_password }}"
        server_url: "{{ foreman_server_url }}"
        validate_certs: "{{ foreman_validate_certs }}"
        organization: "{{ foreman_organization }}"
        name: "Test"
        lifecycle_environment: "Test"
        content_view: "cv_azure_ubuntu_24_3rdParty"
        content_overrides:
          - label: Nginx
            override: enabled

Output with the Error:

TASK [Debug] ************************************************************************************************************************************************************************************************************
Thursday 12 December 2024  17:20:46 +0100 (0:00:03.749)       0:00:04.305 ***** 
ok: [localhost] => {
    "msg": {
        "changed": false,
        "content_view": {

##### Redacted #####

            "repositories": [
                {
                    "content_type": "deb",
                    "id": 3900,
                    "label": "Ubuntu24_nginx_stable",
                    "name": "Ubuntu24_nginx_stable"
                },
                {
                    "content_type": "deb",
                    "id": 3895,
                    "label": "Ubuntu24_nginx_mainline",
                    "name": "Ubuntu24_nginx_mainline"
                }
            ],
            "repository_ids": [
                3900,
                3895
            ],

##### Redacted #####     

                }
            ]
        },
        "failed": false
    }
}

TASK [Test] *************************************************************************************************************************************************************************************************************
Thursday 12 December 2024  17:20:46 +0100 (0:00:00.119)       0:00:04.424 ***** 
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error while performing content_override on activation_keys: Error while performing content_override on activation_keys: 400 Client Error: Bad Request for url: https://zdeaal10iapp031.zeiss.org/katello/api/activation_keys/40/content_override - {'displayMessage': 'Content label(s) \"Nginx\" were not found in the Organization \"CIT-OD\"', 'errors': ['Content label(s) \"Nginx\" were not found in the Organization \"CIT-OD\"']}"}
EXPECTED RESULTS

Content Overrides should get enabled or diabled according to my config.

ACTUAL RESULTS
TASK [Test] *************************************************************************************************************************************************************************************
task path: /mnt/c/Users/ZOJOETTI/OneDrive - Carl Zeiss AG/Documents/git/Ansible/orcharhino_config/playbooks/main.yml:43
Thursday 12 December 2024  17:38:26 +0100 (0:00:00.749)       0:00:00.749 ***** 
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: jake
<127.0.0.1> EXEC /bin/sh -c 'echo ~jake && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/jake/.ansible/tmp `"&& mkdir "` echo /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205 `" && echo ansible-tmp-1734021506.6104803-212656-87089215014205="` echo /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205 `" ) && sleep 0'
Using module file /home/jake/.ansible/collections/ansible_collections/theforeman/foreman/plugins/modules/activation_key.py
<127.0.0.1> PUT /home/jake/.ansible/tmp/ansible-local-2126228hwa8hap/tmpbsuxween TO /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205/AnsiballZ_activation_key.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205/ /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205/AnsiballZ_activation_key.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/jake/ansible-env/bin/python3 /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205/AnsiballZ_activation_key.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/jake/.ansible/tmp/ansible-tmp-1734021506.6104803-212656-87089215014205/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_theforeman.foreman.activation_key_payload_zi40axab/ansible_theforeman.foreman.activation_key_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/foreman_helper.py", line 1157, in resource_action
    result = self.foremanapi.resource_action(resource, action, params, options, data, files, ignore_task_errors)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_theforeman.foreman.activation_key_payload_zi40axab/ansible_theforeman.foreman.activation_key_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/_apypie.py", line 697, in resource_action
    raise ForemanApiException.from_exception(exc, msg) from exc
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "auto_attach": null,
            "content_overrides": [
                {
                    "label": "Nginx",
                    "override": "enabled"
                }
            ],
            "content_view": "cv_azure_ubuntu_24_3rdParty",
            "description": null,
            "host_collections": null,
            "lifecycle_environment": "Test",
            "max_hosts": null,
            "name": "Test",
            "new_name": null,
            "organization": "CIT-OD",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "purpose_addons": null,
            "purpose_role": null,
            "purpose_usage": null,
            "release_version": null,
            "server_url": "https://zdeaal10iapp031.zeiss.org",
            "service_level": null,
            "state": "present",
            "subscriptions": null,
            "unlimited_hosts": null,
            "username": "apiuser",
            "validate_certs": false
        }
    },
    "msg": "Error while performing content_override on activation_keys: Error while performing content_override on activation_keys: 400 Client Error: Bad Request for url: https://zdeaal10iapp031.zeiss.org/katello/api/activation_keys/40/content_override - {'displayMessage': 'Content label(s) \"Nginx\" were not found in the Organization \"CIT-OD\"', 'errors': ['Content label(s) \"Nginx\" were not found in the Organization \"CIT-OD\"']}"
}
@JaketheZ
Copy link
Author

Problem ist gelöst.
Das Label sollte wie folgt aufgebaut sein.
Organisation + _+ Productname + _ + Repositoryname

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

No branches or pull requests

1 participant