Skip to content

Commit

Permalink
fix: make role work on el 8.8 and el 9.2 and podman version less than…
Browse files Browse the repository at this point in the history
… 4.7.0

Cause: Role was using podman and loginctl features not supported on el 8.8/9.2
and podman versions less than 4.7.0.  NetworkName and VolumeName not supported
until podman 4.7.0.  loginctl -P not supported in el 8.8/9.2.

Consequence: The role would give failures when managing el 8.8/9.2 machines.

Fix: Do not test with NetworkName and VolumeName when podman version is less
than 4.7.0.  Use loginctl --value -p instead of -P which will work on all
versions.

Result: The role can manage el 8.8/9.2 machines.

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Oct 28, 2024
1 parent 881a035 commit 201bd71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tasks/cancel_linger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
removes: /var/lib/systemd/linger/{{ __podman_linger_user }}

- name: Wait for user session to exit closing state # noqa no-handler
command: loginctl show-user -P State {{ __podman_linger_user | quote }}
command: loginctl show-user --value -p State {{ __podman_linger_user | quote }}
register: __user_state
changed_when: false
until: __user_state.stdout != "closing"
Expand All @@ -82,7 +82,7 @@
state: stopped

- name: Wait for user session to exit closing state
command: loginctl show-user -P State {{ __podman_linger_user | quote }}
command: loginctl show-user --value -p State {{ __podman_linger_user | quote }}
changed_when: false
register: __user_state
until: __user_state.stderr is match(__pat) or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
Subnet=192.168.29.0/24
Gateway=192.168.29.1
Label=app=wordpress
{% if podman_version is version("4.7.0", ">=") %}
NetworkName=quadlet-basic-name
{% endif %}
6 changes: 3 additions & 3 deletions tests/tests_quadlet_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
state: present
data: "{{ __json_secret_data | string }}"
__podman_quadlet_specs:
- file_src: files/quadlet-basic.network
- template_src: templates/quadlet-basic.network.j2
state: started
- name: quadlet-basic-unused-network
type: network
Network: {}
- name: quadlet-basic-mysql
type: volume
Volume:
VolumeName: quadlet-basic-mysql-name
Volume: "{{ {} if podman_version is version('4.7.0', '<')
else {'VolumeName': 'quadlet-basic-mysql-name'} }}"
- name: quadlet-basic-unused-volume
type: volume
Volume: {}
Expand Down

0 comments on commit 201bd71

Please sign in to comment.