From 7849f27453fe1d9c29a43c71cff8f5b666bd43b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Wed, 14 Feb 2024 11:15:16 +0100 Subject: [PATCH] accept yum history and info as valid commands (#4025) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- .../playbooks/rule-command-instead-of-module-pass.yml | 10 ++++++++++ src/ansiblelint/rules/command_instead_of_module.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/playbooks/rule-command-instead-of-module-pass.yml b/examples/playbooks/rule-command-instead-of-module-pass.yml index c0a26e9e53..d354225be2 100644 --- a/examples/playbooks/rule-command-instead-of-module-pass.yml +++ b/examples/playbooks/rule-command-instead-of-module-pass.yml @@ -5,9 +5,11 @@ - name: Print current git branch ansible.builtin.command: git branch changed_when: false + - name: Print git log ansible.builtin.command: git log changed_when: false + - name: Install git lfs support ansible.builtin.command: git lfs install changed_when: false @@ -35,3 +37,11 @@ - name: Clear yum cache ansible.builtin.command: "" changed_when: false + + - name: Print yum history + ansible.builtin.command: yum history + changed_when: false + + - name: Print yum info + ansible.builtin.command: yum info bash + changed_when: false diff --git a/src/ansiblelint/rules/command_instead_of_module.py b/src/ansiblelint/rules/command_instead_of_module.py index 9118db04be..351b57aa2e 100644 --- a/src/ansiblelint/rules/command_instead_of_module.py +++ b/src/ansiblelint/rules/command_instead_of_module.py @@ -78,7 +78,7 @@ class CommandsInsteadOfModulesRule(AnsibleLintRule): "show-environment", "status", ], - "yum": ["clean"], + "yum": ["clean", "history", "info"], "rpm": ["--nodeps"], }