theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
147 stars 163 forks source link

theforeman.foreman.installation_medium: Found too many (12) results while searching for operatingsystems with title~"Debian" #1046

Open markgraf opened 3 years ago

markgraf commented 3 years ago
SUMMARY

Creation of an installation_medium fails if I only give "- Debian" as an operatingsystem, but succeeds when I give a long list instead. Now I guess having one mirror for all your Debian-versions is not too extraordinary? 12 or more versions on one server should not pose a problem?

ISSUE TYPE
ANSIBLE VERSION
$ ansible --version
ansible 2.10.2
COLLECTION VERSION
Collection               Version
------------------------ -------
theforeman.foreman       1.4.0 
KATELLO/FOREMAN VERSION

Dockerized Foreman, Version 2.2.0-develop

STEPS TO REPRODUCE

Try to create an installation_medium and give only operatingsystems: ['Debian'] as below and fail If you give a long list of items instead:

    - Debian 9
    - Debian 9.4
    - Debian 9.5
    - Debian 9.6
    - Debian 9.8
    - Debian 9.9
    - Debian 9.10
    - Debian 9.11
    - Debian 9.12
    - Debian 9.13
    - Debian 10
    - Debian 10.1

the medium will be created --even though its the same number of items .

---
- name: testcase
  hosts: localhost

  tasks:
    - name: create installation_medium
      theforeman.foreman.installation_medium:
        locations: Default Location
        name: My Debian Mirror
        operatingsystems:
          - Debian
        organizations: Default Organization
        os_family: Debian
        password: Gandalf
        path: http://ftp.debian.org/debian
        server_url: http://localhost:8080/
        username: admin
EXPECTED RESULTS

I expected the creation of the installation_medium to succeed.

ACTUAL RESULTS
Found too many (12) results while searching for operatingsystems with title~"Debian"
wbclark commented 3 years ago

A related problem is: https://github.com/theforeman/foreman-ansible-modules/issues/946

For now, as you already found, you will need to specify the full operating system title in order to associate multiple operating systems (there is no wildcard)

wbclark commented 3 years ago

A lot of the discussion on this topic is at https://github.com/theforeman/foreman-ansible-modules/issues/373