diff --git a/changelogs/fragments/1390-update-docstring-zos_tso_command.yml b/changelogs/fragments/1390-update-docstring-zos_tso_command.yml new file mode 100644 index 000000000..3214e07e5 --- /dev/null +++ b/changelogs/fragments/1390-update-docstring-zos_tso_command.yml @@ -0,0 +1,3 @@ +trivial: + - zos_tso_command - Updated docstrings to numpy style for visual aid to developers. + (https://github.com/ansible-collections/ibm_zos_core/pull/1390). \ No newline at end of file diff --git a/plugins/modules/zos_tso_command.py b/plugins/modules/zos_tso_command.py index 6c2cb6ef6..a04b516ea 100644 --- a/plugins/modules/zos_tso_command.py +++ b/plugins/modules/zos_tso_command.py @@ -135,6 +135,23 @@ def run_tso_command(commands, module, max_rc): + """Run tso command. + + Parameters + ---------- + commands : str + Commands to run. + module : AnsibleModule + Ansible module to run the command with. + max_rc : int + Max return code. + + Returns + ------- + Union[dict] + The command result details. + + """ script = """/* REXX */ PARSE ARG cmd address tso @@ -152,6 +169,24 @@ def run_tso_command(commands, module, max_rc): def copy_rexx_and_run_commands(script, commands, module, max_rc): + """Copy rexx and run commands + + Parameters + ---------- + script : str + Script to run the command. + commands : str + Commands to run. + module : AnsibleModule + Ansible module to run the command with. + max_rc : int + Max return code. + + Returns + ------- + Union[dict] + The command result details. + """ command_detail_json = [] delete_on_close = True tmp_file = NamedTemporaryFile(delete=delete_on_close) @@ -180,6 +215,25 @@ def copy_rexx_and_run_commands(script, commands, module, max_rc): def list_or_str_type(contents, dependencies): + """Checks if a variable contains a string or a list of strings and returns it as a list of strings. + + Parameters + ---------- + contents : str | list[str] + String or list of strings. + dependencies + Unused. + + Returns + ------- + str | Union[str] + The parameter given as a list of strings. + + Raises + ------ + ValueError + Invalid argument type. Expected "string or list of strings". + """ failed = False if isinstance(contents, list): for item in contents: @@ -200,6 +254,17 @@ def list_or_str_type(contents, dependencies): def run_module(): + """Initialize module. + + Raises + ------ + fail_json + ValueError on BetterArgParser. + fail_json + Some command(s) failed. + fail_json + An unexpected error occurred. + """ module_args = dict( commands=dict(type="raw", required=True, aliases=["command"]), max_rc=dict(type="int", required=False, default=0),