From c08e7fc14deae54ef5091d11c74ab4ae99785e4d Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 16 Aug 2024 11:40:43 -0700 Subject: [PATCH] Remove test module (#266) * removed test module upcase from the collection Signed-off-by: Abhijeet Kasurde Co-authored-by: Sorin Sbarnea --- plugins/modules/upcase.py | 92 ------------------------------- roles/test_role/README.md | 36 ------------ roles/test_role/defaults/main.yml | 3 - roles/test_role/handlers/main.yml | 2 - roles/test_role/meta/main.yml | 52 ----------------- roles/test_role/tasks/main.yml | 6 -- roles/test_role/tests/inventory | 1 - roles/test_role/tests/test.yml | 7 --- roles/test_role/vars/main.yml | 2 - 9 files changed, 201 deletions(-) delete mode 100644 plugins/modules/upcase.py delete mode 100644 roles/test_role/README.md delete mode 100644 roles/test_role/defaults/main.yml delete mode 100644 roles/test_role/handlers/main.yml delete mode 100644 roles/test_role/meta/main.yml delete mode 100644 roles/test_role/tasks/main.yml delete mode 100644 roles/test_role/tests/inventory delete mode 100644 roles/test_role/tests/test.yml delete mode 100644 roles/test_role/vars/main.yml diff --git a/plugins/modules/upcase.py b/plugins/modules/upcase.py deleted file mode 100644 index e6fa6622..00000000 --- a/plugins/modules/upcase.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/python - -# 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 . - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -DOCUMENTATION = r""" ---- -module: upcase -short_description: Upper cases a passed in string - -version_added: "1.0.0" - -description: Upper cases a passed in string, if the passed in string is already uppercase, changed is set to false. - To have the module generate an error send the string fail - -options: - name: - description: This is the string sent to the upcase module. - required: true - type: str -author: - - Test User (@yourGitHubHandle) -""" # noqa: E501 - -EXAMPLES = r""" -# Pass in a message -- name: Test with a lower string - ansible.eda.upcase: - name: hello world - -# pass in a message and have it fail -- name: Test with a fail message - ansible.eda.upcase: - name: fail -""" - -RETURN = r""" -message: - description: The result message that the upcase module generates. - type: str - returned: always - sample: 'HELLO WORLD' -""" - -from ansible.module_utils.basic import AnsibleModule # noqa: E402 - - -def run_module(): - module_args = dict(name=dict(type="str", required=True)) - - result = dict(changed=False, message="") - - module = AnsibleModule(argument_spec=module_args, supports_check_mode=True) - - # if the user is working with this module in only check mode we do not - # want to make any changes to the environment, just return the current - # state with no modifications - if module.check_mode: - module.exit_json(**result) - - # during the execution of the module, if there is an exception or a - # conditional state that effectively causes a failure, run - # AnsibleModule.fail_json() to pass in the message and the result - if module.params["name"] == "fail": - module.fail_json(msg="You requested this to fail", **result) - - # Success - result["message"] = module.params["name"].upper() - result["changed"] = result["message"] != module.params["name"] - module.exit_json(**result) - - -def main(): - run_module() - - -if __name__ == "__main__": - main() diff --git a/roles/test_role/README.md b/roles/test_role/README.md deleted file mode 100644 index 229d4f37..00000000 --- a/roles/test_role/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Role Name -========= - -This role calls the module upcase - -Requirements ------------- -None - -Role Variables --------------- - -test_name - -Dependencies ------------- - - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - collections: - - ansible.eda - roles: - - { role: test_role, test_name: 42 } - -License -------- - -BSD - -Author Information ------------------- diff --git a/roles/test_role/defaults/main.yml b/roles/test_role/defaults/main.yml deleted file mode 100644 index 25b35c81..00000000 --- a/roles/test_role/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# defaults file for test_role -test_name: "fred" diff --git a/roles/test_role/handlers/main.yml b/roles/test_role/handlers/main.yml deleted file mode 100644 index 55290cba..00000000 --- a/roles/test_role/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for test_role diff --git a/roles/test_role/meta/main.yml b/roles/test_role/meta/main.yml deleted file mode 100644 index c572acc9..00000000 --- a/roles/test_role/meta/main.yml +++ /dev/null @@ -1,52 +0,0 @@ -galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) - - min_ansible_version: 2.1 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. diff --git a/roles/test_role/tasks/main.yml b/roles/test_role/tasks/main.yml deleted file mode 100644 index d100171e..00000000 --- a/roles/test_role/tasks/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# tasks file for test_role -- name: Call the module upcase - ansible.eda.upcase: - name: "{{ test_name }}" - register: upcase_test diff --git a/roles/test_role/tests/inventory b/roles/test_role/tests/inventory deleted file mode 100644 index 2fbb50c4..00000000 --- a/roles/test_role/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/roles/test_role/tests/test.yml b/roles/test_role/tests/test.yml deleted file mode 100644 index fda98ee7..00000000 --- a/roles/test_role/tests/test.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- hosts: localhost - remote_user: root - collections: - - ansible.eda - roles: - - { role: test_role, test_name: fred } diff --git a/roles/test_role/vars/main.yml b/roles/test_role/vars/main.yml deleted file mode 100644 index d56c78b2..00000000 --- a/roles/test_role/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for test_role