|
48 | 48 | HOME: /home/tmachine |
49 | 49 | XDG_RUNTIME_DIR: /run/user/1000 |
50 | 50 |
|
| 51 | + # The binaries installer runs a plain-HTTP gateway named tmachine from a |
| 52 | + # system service and puts the CLI in /usr/local/bin. The package installers |
| 53 | + # run the packaged user service, install the CLI in /usr/bin and register |
| 54 | + # the gateway as openshell, using the package default network and namespace. |
| 55 | + - name: Detect the installer |
| 56 | + ansible.builtin.stat: |
| 57 | + path: /usr/local/bin/openshell |
| 58 | + register: podman_e2e_binaries_cli |
| 59 | + |
| 60 | + - name: Select the gateway under test |
| 61 | + ansible.builtin.set_fact: |
| 62 | + podman_e2e_binaries: "{{ podman_e2e_binaries_cli.stat.exists }}" |
| 63 | + podman_e2e_cli: "{{ '/usr/local/bin/openshell' if podman_e2e_binaries_cli.stat.exists else '/usr/bin/openshell' }}" |
| 64 | + podman_e2e_gateway: "{{ 'tmachine' if podman_e2e_binaries_cli.stat.exists else 'openshell' }}" |
| 65 | + |
51 | 66 | - name: Remove any previous OpenShell gateway registration |
| 67 | + when: podman_e2e_binaries |
52 | 68 | ansible.builtin.command: |
53 | 69 | argv: [/usr/local/bin/openshell, gateway, remove, tmachine] |
54 | 70 | changed_when: false |
55 | 71 | failed_when: false |
56 | 72 |
|
57 | 73 | - name: Register the configured OpenShell gateway |
| 74 | + when: podman_e2e_binaries |
58 | 75 | ansible.builtin.command: |
59 | 76 | argv: [/usr/local/bin/openshell, gateway, add, http://127.0.0.1:17670, --local, --name, tmachine] |
60 | 77 |
|
|
75 | 92 | CONTAINER_ENGINE: podman |
76 | 93 | CONTAINER_HOST: unix:///run/user/1000/podman/podman.sock |
77 | 94 | HOME: /home/tmachine |
78 | | - OPENSHELL_BIN: /usr/local/bin/openshell |
| 95 | + OPENSHELL_BIN: "{{ podman_e2e_cli }}" |
79 | 96 | OPENSHELL_E2E_CONTAINER_ENGINE_UNSET_XDG_CONFIG_HOME: "1" |
80 | 97 | OPENSHELL_E2E_DRIVER: podman |
81 | | - OPENSHELL_E2E_NETWORK_NAME: tmachine |
82 | | - OPENSHELL_E2E_SANDBOX_NAMESPACE: tmachine |
83 | | - OPENSHELL_GATEWAY: tmachine |
| 98 | + OPENSHELL_E2E_NETWORK_NAME: "{{ podman_e2e_gateway }}" |
| 99 | + OPENSHELL_E2E_SANDBOX_NAMESPACE: "{{ podman_e2e_gateway }}" |
| 100 | + OPENSHELL_GATEWAY: "{{ podman_e2e_gateway }}" |
84 | 101 | OPENSHELL_PODMAN_SOCKET: /run/user/1000/podman/podman.sock |
85 | 102 | XDG_RUNTIME_DIR: /run/user/1000 |
86 | 103 | register: podman_e2e_test_result |
|
96 | 113 | var: podman_e2e_test_result.stdout_lines |
97 | 114 |
|
98 | 115 | - name: Capture OpenShell gateway journal after Podman E2E test failure |
99 | | - become: true |
| 116 | + become: "{{ podman_e2e_binaries }}" |
100 | 117 | ansible.builtin.command: |
101 | | - argv: [journalctl, --unit, openshell-gateway.service, --no-pager, --lines, "200"] |
| 118 | + argv: >- |
| 119 | + {{ ['journalctl', '--unit', 'openshell-gateway.service', '--no-pager', '--lines', '200'] |
| 120 | + if podman_e2e_binaries else |
| 121 | + ['journalctl', '--user-unit', 'openshell-gateway.service', '--no-pager', '--lines', '200'] }} |
102 | 122 | changed_when: false |
103 | 123 | failed_when: false |
104 | 124 | when: podman_e2e_test_result.rc != 0 |
|
0 commit comments