From a7922e498ca8fa62aef89b47174868f0d8d0ae7d Mon Sep 17 00:00:00 2001 From: Daniel Brennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 10 Sep 2026 14:36:47 +0100 Subject: [PATCH] Fix ansible-lint no-changed-when and execution-environment schema warnings (#1196) * Fix ansible-lint no-changed-when and execution-environment schema warnings Add `changed_when: false` to example command tasks in the kubectl connection plugin to resolve no-changed-when warnings from ansible-lint. Add `version: 3` to meta/execution-environment.yml to satisfy the schema[execution-environment] rule requiring the version property. Co-Authored-By: Claude Opus 4.6 (1M context) * Add changelog fragment for ansible-lint warning fixes Co-Authored-By: Claude Opus 4.6 (1M context) * Fix changelog fragment YAML formatting Quote strings to avoid YAML parsing ambiguity in the trivial section. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- changelogs/fragments/fix-ansible-lint-warnings.yaml | 3 +++ meta/execution-environment.yml | 1 + plugins/connection/kubectl.py | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 changelogs/fragments/fix-ansible-lint-warnings.yaml diff --git a/changelogs/fragments/fix-ansible-lint-warnings.yaml b/changelogs/fragments/fix-ansible-lint-warnings.yaml new file mode 100644 index 00000000..19a0f0e3 --- /dev/null +++ b/changelogs/fragments/fix-ansible-lint-warnings.yaml @@ -0,0 +1,3 @@ +trivial: + - "kubectl connection plugin - added ``changed_when: false`` to example ``ansible.builtin.command`` tasks to resolve ansible-lint ``no-changed-when`` warnings." + - "ee - added ``version: 3`` to ``meta/execution-environment.yml`` to resolve ansible-lint ``schema[execution-environment]`` warning." diff --git a/meta/execution-environment.yml b/meta/execution-environment.yml index d950e22a..71192bcf 100644 --- a/meta/execution-environment.yml +++ b/meta/execution-environment.yml @@ -1,4 +1,5 @@ --- +version: 3 dependencies: python: requirements.txt system: meta/ee-bindep.txt diff --git a/plugins/connection/kubectl.py b/plugins/connection/kubectl.py index e80482fd..e97c0ba9 100644 --- a/plugins/connection/kubectl.py +++ b/plugins/connection/kubectl.py @@ -196,6 +196,7 @@ EXAMPLES = r""" # and requires python to be installed in the image - name: Run a command in a pod ansible.builtin.command: echo "Hello, World!" + changed_when: false - name: Run a command in a pod using local kubectl with inventory variables # Example inventory: @@ -220,6 +221,7 @@ EXAMPLES = r""" # and requires python to be installed in the image - name: Run a command in a pod ansible.builtin.command: echo "Hello, World!" + changed_when: false - name: Run a command in a pod using dynamic inventory hosts: localhost @@ -253,6 +255,7 @@ EXAMPLES = r""" # be aware that the command is executed as the user that started the container # and requires python to be installed in the image ansible.builtin.command: echo "Hello, World!" + changed_when: false delegate_to: "{{ my_app_pod_name }}" """