From f2699650f1145d621a355efc520fa8437d7db364 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Sat, 18 Jan 2025 10:12:55 +0000 Subject: [PATCH] WIP --- .../issue_766__get_with_context.yml | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/tests/ansible/regression/issue_766__get_with_context.yml b/tests/ansible/regression/issue_766__get_with_context.yml index 136b5dfec..c0044c740 100644 --- a/tests/ansible/regression/issue_766__get_with_context.yml +++ b/tests/ansible/regression/issue_766__get_with_context.yml @@ -2,31 +2,38 @@ --- - name: regression/issue_766__get_with_context.yml hosts: localhost + # Gather facts to use *and* to trigger any "could not recover task_vars" error + # https://github.com/mitogen-hq/mitogen/pull/1215#issuecomment-2596421111 gather_facts: true + vars: + netconf_container_image: ghcr.io/mitogen-hq/sysrepo-netopeer2:latest + netconf_container_name: sysprep + netconf_container_port: 8030 tasks: + - meta: end_play + when: + - ansible_facts.system == 'Darwin' + - block: - name: Start container - delegate_to: localhost - vars: - ansible_port: 8040 - containers.podman.podman_container: - name: sysprep - image: ghcr.io/mitogen-hq/sysrepo-netopeer2:latest - auto_remove: true - detach: true - recreate: true - published_ports: - - "{{ ansible_port }}:830" + command: + cmd: >- + podman run + --name "{{ netconf_container_name }}" + --detach + --rm + --publish "{{ netconf_container_port }}:830" + "{{ netconf_container_image }}" + changed_when: true - name: Wait for container - delegate_to: localhost # TODO robust condition. wait_for + search_regex? wait_for_connection? wait_for: timeout: 5 - name: Get running configuration and state data vars: - ansible_port: 8040 + ansible_port: "{{ netconf_container_port }}" ansible_connection: netconf ansible_user: netconf ansible_password: netconf @@ -34,7 +41,11 @@ always: - name: Cleanup container - delegate_to: localhost - containers.podman.podman_container: - name: sysprep - state: absent + command: + cmd: "{{ item.cmd }}" + loop: + - cmd: podman stop "{{ netconf_container_name }}" + - cmd: podman rm "{{ netconf_container_name }}" + changed_when: true + tags: + - issue_766