From 7a66a26b770db6516939406054ee7168562f1003 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 2 Feb 2023 13:07:08 +1100 Subject: [PATCH] ansible-lint: fix a bunch of command-instead-of-shell errors These all trigger command-instead-of-shell for ansible-lint 6.12.0. It seems a few were ignored with warnings with I4e415cbd34f0f4cb15857051bf95458e0316de86. I don't see why these can't be command: for consistency Change-Id: Ib0f590b461d2a5a7d9bb8bdddcbbfb2230cc3d1c --- test-playbooks/ensure-nox.yaml | 8 ++------ test-playbooks/ensure-tox.yaml | 8 ++------ .../registry/buildset-registry-k8s-microk8s.yaml | 8 ++------ test-playbooks/tox/reinstall-tox.yaml | 8 ++------ test-playbooks/upload-git-mirror.yaml | 4 +--- 5 files changed, 9 insertions(+), 27 deletions(-) diff --git a/test-playbooks/ensure-nox.yaml b/test-playbooks/ensure-nox.yaml index 2e6883178..f89c184d9 100644 --- a/test-playbooks/ensure-nox.yaml +++ b/test-playbooks/ensure-nox.yaml @@ -2,15 +2,11 @@ name: Remove any pre-installed nox tasks: - name: Remove nox package with pip - shell: pip uninstall -y nox - args: - warn: false + command: pip uninstall -y nox become: true failed_when: false - name: Remove nox package with pip3 - shell: pip3 uninstall -y nox - args: - warn: false + command: pip3 uninstall -y nox become: true failed_when: false - name: Verify nox is not installed diff --git a/test-playbooks/ensure-tox.yaml b/test-playbooks/ensure-tox.yaml index 5ea93d5c4..46ea17d8e 100644 --- a/test-playbooks/ensure-tox.yaml +++ b/test-playbooks/ensure-tox.yaml @@ -2,15 +2,11 @@ name: Remove any pre-installed tox tasks: - name: Remove tox package with pip - shell: pip uninstall -y tox - args: - warn: false + command: pip uninstall -y tox become: true failed_when: false - name: Remove tox package with pip3 - shell: pip3 uninstall -y tox - args: - warn: false + command: pip3 uninstall -y tox become: true failed_when: false - name: Verify tox is not installed diff --git a/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml b/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml index bc608015e..f893bfe21 100644 --- a/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml +++ b/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml @@ -22,15 +22,13 @@ seconds: 60 - name: Describe pod - shell: kubectl describe pods quaytest + command: kubectl describe pods quaytest - name: Wait for the pod to be ready command: kubectl wait --for=condition=Ready pod/quaytest --timeout=60s - name: Check the output of the pod shell: "kubectl logs pod/quaytest | grep 'Zuul container test'" - args: - warn: false - name: Run a remote test pod command: kubectl run --image=docker.io/debian:testing upstream-dockertest --command -- /bin/bash -c 'echo Upstream; sleep infinity' @@ -40,12 +38,10 @@ seconds: 60 - name: Describe pod - shell: kubectl describe pods upstream-dockertest + command: kubectl describe pods upstream-dockertest - name: Wait for the pod to be ready command: kubectl wait --for=condition=Ready pod/upstream-dockertest --timeout=60s - name: Check the output of the pod shell: "kubectl logs pod/upstream-dockertest | grep 'Upstream'" - args: - warn: false diff --git a/test-playbooks/tox/reinstall-tox.yaml b/test-playbooks/tox/reinstall-tox.yaml index 8ee182014..e04ea883e 100644 --- a/test-playbooks/tox/reinstall-tox.yaml +++ b/test-playbooks/tox/reinstall-tox.yaml @@ -2,15 +2,11 @@ name: Remove any pre-installed tox tasks: - name: Remove tox package with pip - shell: pip uninstall -y tox - args: - warn: false + command: pip uninstall -y tox become: true failed_when: false - name: Remove tox package with pip3 - shell: pip3 uninstall -y tox - args: - warn: false + command: pip3 uninstall -y tox become: true failed_when: false - name: Verify tox is not installed diff --git a/test-playbooks/upload-git-mirror.yaml b/test-playbooks/upload-git-mirror.yaml index 3ec58437b..603be5d9e 100644 --- a/test-playbooks/upload-git-mirror.yaml +++ b/test-playbooks/upload-git-mirror.yaml @@ -30,9 +30,7 @@ key: "{{ public_key_contents.stdout }}" - name: Get localhost ssh host public key - shell: ssh-keyscan -t rsa localhost - args: - warn: false + command: ssh-keyscan -t rsa localhost register: host_key tasks: - name: Get git commit hash for current patch of zuul-jobs