Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-21200

smart_proxy module fails when 2 or more lifecycle environments have the same name

XMLWordPrintable

    • Moderate
    • Manual
    • None

      Description of problem:
      The smart_proxy module [0] fails when Satellite has 2 or more lifecycle environments with the same name.

      Version-Release number of selected component (if applicable):

      • Satellite 6.13
      • ansible-core-2.14.2-4.el8_8.x86_64
      • redhat.satellite 3.9.0

      How reproducible:

      • Easy

      Steps to Reproduce:

      • Create multiple orgs on Satellite. Each org has its own Library lifecycle env:

      hammer> organization list
      --|--------------------|--------------------|-----------|--------------------
      ID | TITLE | NAME | DESCRIPTION | LABEL
      --|--------------------|--------------------|-----------|--------------------
      1 | Default Organization | Default Organization | | Default_Organization
      4 | org_a | org_a | | org_a
      5 | org_b | org_b | | org_b
      6 | org_c | org_c | | org_c
      7 | org_d | org_d | | org_d
      8 | org_e | org_e | | org_e
      3 | test | test | | test
      --|--------------------|--------------------|-----------|--------------------

      hammer> lifecycle-environment list
      --|-------|-------
      ID | NAME | PRIOR
      --|-------|-------
      2 | DEV | Library
      8 | Library |
      7 | Library |
      6 | Library |
      5 | Library |
      4 | Library |
      3 | Library |
      1 | Library |
      --|-------|-------

      • Create role which creates a new smart proxy, e.g.:

      1. tasks file for capsule_create
      • name: Settings for the Smart Proxy
        redhat.satellite.smart_proxy:
        username: "admin"
        password: "redhat"
        server_url: "https://{{ ansible_fqdn }}"
        name: "jsenkyri-cap-test.sysmgmt.lan"
        url: "https://jsenkyri-cap-test.sysmgmt.lan:9090"
        download_policy: "on_demand"
        lifecycle_environments: "Library"
        organizations: "Default Organization"
        locations: "Default Location"
        state: present
      • Run a playbook which calls this role. I am running it directly from Satellite:

      [root@jsenkyri-sat-latest ansible]# ansible-playbook -i hosts -l jsenkyri-sat-latest.sysmgmt.lan run_capsule_create.yaml --check --ask-pass
      SSH password:

      PLAY [Run role named test] **********************************************************************************************************************************************************

      TASK [Gathering Facts] **************************************************************************************************************************************************************
      ok: [jsenkyri-sat-latest.sysmgmt.lan]

      TASK [capsule_create : Settings for the Smart Proxy] ********************************************************************************************************************************
      fatal: [jsenkyri-sat-latest.sysmgmt.lan]: FAILED! =>

      {"changed": false, "msg": "Found too many (7) results while searching for lifecycle_environments with name=\"Library\""}

      PLAY RECAP **************************************************************************************************************************************************************************
      jsenkyri-sat-latest.sysmgmt.lan : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

      Actual results:

      • The playbook fails because there are multiple life cycle envs named "Library".

      Expected results:

      • The playbook creates a smart proxy with selected lifecycle envs & organizations.

      Additional info:

      • Using lifecycle env id instead of its name might help here.

      [0] https://console.redhat.com/ansible/automation-hub/repo/published/redhat/satellite/content/module/smart_proxy/

              jira-bugzilla-migration RH Bugzilla Integration
              rhn-support-jsenkyri Jan Senkyrik
              RH Bugzilla Integration RH Bugzilla Integration
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: