linux-system-roles / rhc

Role to manage RH subscription management and Insights
https://linux-system-roles.github.io/rhc/
MIT License
10 stars 15 forks source link

tests: run podman directly instead of using containers.podman #196

Closed ptoscano closed 3 months ago

ptoscano commented 3 months ago

Using the containers.podman collection to handle podman is a nice idea, however what that collection supports now is becoming more strict than what this role supports. Case in point: containers.podman now requires Python 3.6+ for the managed nodes, which breaks the testing of EL 7.

This means that sadly the setup of a self-deployed Candlepin needs to run podman commands manually; use the proper parameters for podman run depending on the OS.

The gymnastics of checking the return code & stderr of podman stop are needed because the --ignore option (which would be ideal) was introduced in podman 1.7.0, and EL 7 has podman 1.6.4.

There is no behaviour change.

ptoscano commented 3 months ago

[citest]

ptoscano commented 3 months ago

[citest]

ptoscano commented 3 months ago

[citest]

ptoscano commented 3 months ago

[citest]

richm commented 3 months ago

Another way to dynamically construct lists in an assignment statement where you want to omit some of the elements is like this:

    - name: Start Candlepin container
      command:
        argv:
          "{{ podman_run_cli }}"
      changed_when: false
      vars:
        podman_run_cli: [podman, run, --rm, --detach, --hostname, candlepin_host, --name, candlepin, --publish,
                                        8443:8443, --publish, 8080:8080] +
                                        {{ ['--privileged'] if (ansible_distribution in ['CentOS', 'RedHat']
                                            and ansible_distribution_major_version | int < 8)
                                            else [] }} + [ghcr.io/ptoscano/candlepin-unofficial]

Yes, it uses the "json" style of list definition, but I prefer readability to strict adherence of Ansible guidelines

hmm - the indentation is way off - maybe github is auto-indenting something?

ptoscano commented 3 months ago

[citest]