From 0e9b10048c1d5f5cc56893fa6c235c4948318568 Mon Sep 17 00:00:00 2001 From: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Date: Tue, 18 Feb 2025 06:49:59 -0500 Subject: [PATCH] Add git clean to allowed executable options (#4519) --- examples/playbooks/rule-command-instead-of-module-pass.yml | 4 ++++ src/ansiblelint/rules/command_instead_of_module.py | 2 +- 2 files changed, 5 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 fec33c20c9..a3af5d3b15 100644 --- a/examples/playbooks/rule-command-instead-of-module-pass.yml +++ b/examples/playbooks/rule-command-instead-of-module-pass.yml @@ -14,6 +14,10 @@ ansible.builtin.command: git lfs install changed_when: false + - name: Clean git repo (dry run) + ansible.builtin.command: git clean -n -d + changed_when: false + - name: Show systemctl service status ansible.builtin.command: systemctl status systemd-timesyncd changed_when: false diff --git a/src/ansiblelint/rules/command_instead_of_module.py b/src/ansiblelint/rules/command_instead_of_module.py index 9d17827fb2..af6cda3c05 100644 --- a/src/ansiblelint/rules/command_instead_of_module.py +++ b/src/ansiblelint/rules/command_instead_of_module.py @@ -69,7 +69,7 @@ class CommandsInsteadOfModulesRule(AnsibleLintRule): } _executable_options = { - "git": ["branch", "log", "lfs", "rev-parse"], + "git": ["branch", "log", "lfs", "rev-parse", "clean"], "systemctl": [ "--version", "get-default",