mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Fix stderr false return value (#22845)
* ensure exit_json does not fail from stderr=False - do a little bit of safety-checking in exit_json to not try to .splitlines() on a boolean - remove the stderr=boolean from uri.py, this is the only spot that uses it (at least so obviously) - add unit tests that call exit_json. These are useless because the stderr parsing is in _execute_module and is difficult to mock; deleting these tests after the commit. * remove added unit tests per prev commit exit_json doesn't do the param parsing, that is buried deep inside _execute_module.
This commit is contained in:
@@ -425,15 +425,14 @@ def main():
|
||||
# and the filename already exists. This allows idempotence
|
||||
# of uri executions.
|
||||
if os.path.exists(creates):
|
||||
module.exit_json(stdout="skipped, since %s exists" % creates,
|
||||
changed=False, stderr=False, rc=0)
|
||||
module.exit_json(stdout="skipped, since %s exists" % creates, changed=False, rc=0)
|
||||
|
||||
if removes is not None:
|
||||
# do not run the command if the line contains removes=filename
|
||||
# and the filename do not exists. This allows idempotence
|
||||
# of uri executions.
|
||||
if not os.path.exists(removes):
|
||||
module.exit_json(stdout="skipped, since %s does not exist" % removes, changed=False, stderr=False, rc=0)
|
||||
module.exit_json(stdout="skipped, since %s does not exist" % removes, changed=False, rc=0)
|
||||
|
||||
# Make the request
|
||||
resp, content, dest = uri(module, url, dest, body, body_format, method,
|
||||
|
||||
Reference in New Issue
Block a user