From fc4359b0252ff7e9175805c06f8ce1dcd98558b7 Mon Sep 17 00:00:00 2001 From: grcancelliere Date: Fri, 4 Aug 2023 10:40:03 +0200 Subject: [PATCH] podman: remove ansible_async_dir from create.yml and destroy.yml b5509a19465ba39cfedff0e6450524620a2d6d2f uses $USER to get the home for the current user, but if the controller does not run login(1), like in containers, the variable is not set. Since the original bug that needed ansible_async_dir was fixed (see ansible-community/molecule-podman PR #139 and ansible/creator-ee#19), remove all the related changes. - src/molecule_plugins/podman/playbooks: remove ansible_async_dir tasks from create.yml and destroy.yml - tox.ini: remove USER from the pass_env list --- .../podman/playbooks/create.yml | 18 ------------------ .../podman/playbooks/destroy.yml | 18 ------------------ tox.ini | 1 - 3 files changed, 37 deletions(-) diff --git a/src/molecule_plugins/podman/playbooks/create.yml b/src/molecule_plugins/podman/playbooks/create.yml index e761048f..a65fe633 100644 --- a/src/molecule_plugins/podman/playbooks/create.yml +++ b/src/molecule_plugins/podman/playbooks/create.yml @@ -17,24 +17,6 @@ ansible.builtin.set_fact: podman_cmd: "{{ _podman_path.stdout }}" - - name: Get passwd entries for USER env - ansible.builtin.getent: - database: passwd - key: "{{ lookup('env', 'USER') }}" - - - name: Get shell async_dir - ansible.builtin.set_fact: - _shell_async_dir: >- - {{ lookup('ansible.builtin.config', 'async_dir', plugin_type='shell', plugin_name='sh') - | regex_replace('^~', ansible_facts.getent_passwd[lookup('env', 'USER')][4]) }} - - - name: Set async_dir for HOME env - ansible.builtin.set_fact: - ansible_async_dir: >- - {{ _shell_async_dir - | regex_replace('^' + ansible_facts.getent_passwd[lookup('env', 'USER')][4], lookup('env', 'HOME')) }} - when: lookup('env', 'HOME') != ansible_facts.getent_passwd[lookup('env', 'USER')][4] - - name: Log into a container registry ansible.builtin.command: > {{ podman_cmd }} login diff --git a/src/molecule_plugins/podman/playbooks/destroy.yml b/src/molecule_plugins/podman/playbooks/destroy.yml index 26199935..23823c2e 100644 --- a/src/molecule_plugins/podman/playbooks/destroy.yml +++ b/src/molecule_plugins/podman/playbooks/destroy.yml @@ -8,24 +8,6 @@ vars: podman_exec: "{{ lookup('env','MOLECULE_PODMAN_EXECUTABLE')|default('podman',true) }}" tasks: - - name: Get passwd entries for USER env - ansible.builtin.getent: - database: passwd - key: "{{ lookup('env', 'USER') }}" - - - name: Get shell async_dir - ansible.builtin.set_fact: - _shell_async_dir: >- - {{ lookup('ansible.builtin.config', 'async_dir', plugin_type='shell', plugin_name='sh') - | regex_replace('^~', ansible_facts.getent_passwd[lookup('env', 'USER')][4]) }} - - - name: Set async_dir for HOME env - ansible.builtin.set_fact: - ansible_async_dir: >- - {{ _shell_async_dir - | regex_replace('^' + ansible_facts.getent_passwd[lookup('env', 'USER')][4], lookup('env', 'HOME')) }} - when: lookup('env', 'HOME') != ansible_facts.getent_passwd[lookup('env', 'USER')][4] - - name: Destroy molecule instance(s) ansible.builtin.shell: "{{ podman_exec }} container exists {{ item.name }} && {{ podman_exec }} rm -f {{ item.name }} || true" register: server diff --git a/tox.ini b/tox.ini index 3c1f675f..fa395466 100644 --- a/tox.ini +++ b/tox.ini @@ -57,7 +57,6 @@ passenv = SSL_CERT_FILE TOXENV TWINE_* - USER allowlist_externals = bash twine