135
135
136
136
137
137
def run_tso_command (commands , module , max_rc ):
138
+ """Run tso command.
139
+
140
+ Parameters
141
+ ----------
142
+ commands : str
143
+ Commands to run.
144
+ module : AnsibleModule
145
+ Ansible module to run the command with.
146
+ max_rc : int
147
+ Max return code.
148
+
149
+ Returns
150
+ -------
151
+ Union[dict]
152
+ The command result details.
153
+
154
+ """
138
155
script = """/* REXX */
139
156
PARSE ARG cmd
140
157
address tso
@@ -152,6 +169,24 @@ def run_tso_command(commands, module, max_rc):
152
169
153
170
154
171
def copy_rexx_and_run_commands (script , commands , module , max_rc ):
172
+ """Copy rexx into a temporary file and run commands.
173
+
174
+ Parameters
175
+ ----------
176
+ script : str
177
+ Script to run the command.
178
+ commands : str
179
+ Commands to run.
180
+ module : AnsibleModule
181
+ Ansible module to run the command with.
182
+ max_rc : int
183
+ Max return code.
184
+
185
+ Returns
186
+ -------
187
+ Union[dict]
188
+ The command result details.
189
+ """
155
190
command_detail_json = []
156
191
delete_on_close = True
157
192
tmp_file = NamedTemporaryFile (delete = delete_on_close )
@@ -180,6 +215,25 @@ def copy_rexx_and_run_commands(script, commands, module, max_rc):
180
215
181
216
182
217
def list_or_str_type (contents , dependencies ):
218
+ """Checks if a variable contains a string or a list of strings and returns it as a list of strings.
219
+
220
+ Parameters
221
+ ----------
222
+ contents : str | list[str]
223
+ String or list of strings.
224
+ dependencies
225
+ Unused.
226
+
227
+ Returns
228
+ -------
229
+ str | Union[str]
230
+ The parameter given as a list of strings.
231
+
232
+ Raises
233
+ ------
234
+ ValueError
235
+ Invalid argument type. Expected "string or list of strings".
236
+ """
183
237
failed = False
184
238
if isinstance (contents , list ):
185
239
for item in contents :
@@ -200,6 +254,17 @@ def list_or_str_type(contents, dependencies):
200
254
201
255
202
256
def run_module ():
257
+ """Initialize module.
258
+
259
+ Raises
260
+ ------
261
+ fail_json
262
+ ValueError on BetterArgParser.
263
+ fail_json
264
+ Some command(s) failed.
265
+ fail_json
266
+ An unexpected error occurred.
267
+ """
203
268
module_args = dict (
204
269
commands = dict (type = "raw" , required = True , aliases = ["command" ]),
205
270
max_rc = dict (type = "int" , required = False , default = 0 ),
0 commit comments