From e2e9dbddcfd11ea9f92fc49759398f263d894414 Mon Sep 17 00:00:00 2001 From: Naresh krishnan <127166960+Naresh2807@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:20:46 +0530 Subject: [PATCH] improve the code and add command --- hacking/test-module.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/hacking/test-module.py b/hacking/test-module.py index b24cc75e047..8ab29ce3d6b 100755 --- a/hacking/test-module.py +++ b/hacking/test-module.py @@ -1,10 +1,32 @@ #!/usr/bin/env python # (c) 2012, Michael DeHaan -# This file is part of Ansible, a free software under the GNU General Public License - -# This script is for testing Ansible modules without going through the entire Ansible engine. -# It helps developers test modules directly. Example usage is provided in the comments above. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# + +# this script is for testing modules without running through the +# entire guts of ansible, and is very helpful for when developing +# modules +# +# example: +# ./hacking/test-module.py -m lib/ansible/modules/command.py -a "/bin/sleep 3" +# ./hacking/test-module.py -m lib/ansible/modules/command.py -a "/bin/sleep 3" --debugger /usr/bin/pdb +# ./hacking/test-module.py -m lib/ansible/modules/lineinfile.py -a "dest=/etc/exports line='/srv/home hostname1(rw,sync)'" --check +# ./hacking/test-module.py -m lib/ansible/modules/command.py -a "echo hello" -n -o "test_hello" from __future__ import annotations