mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-03-26 21:33:02 +00:00
fix k8s_exec, returning rc attribute to follow ansible's common return values. (#230)
fix k8s_exec, returning rc attribute to follow ansible's common return values. SUMMARY fix #229. ISSUE TYPE Bugfix Pull Request COMPONENT NAME k8s_exec ADDITIONAL INFORMATION Reviewed-by: None <None> Reviewed-by: None <None>
This commit is contained in:
@@ -31,6 +31,7 @@ requirements:
|
||||
- "PyYAML >= 3.11"
|
||||
|
||||
notes:
|
||||
- Return code C(rc) for the command executed is added in output in version 2.3.0, and depricates return code C(return_code).
|
||||
- Return code C(return_code) for the command executed is added in output in version 1.0.0.
|
||||
- The authenticated user must have at least read access to the pods resource and write access to the pods/exec resource.
|
||||
|
||||
@@ -82,7 +83,7 @@ EXAMPLES = r'''
|
||||
- name: Check last command status
|
||||
debug:
|
||||
msg: "cmd failed"
|
||||
when: command_status.return_code != 0
|
||||
when: command_status.rc != 0
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
@@ -104,9 +105,13 @@ result:
|
||||
stderr_lines:
|
||||
description: The command stderr
|
||||
type: str
|
||||
return_code:
|
||||
rc:
|
||||
description: The command status code
|
||||
type: int
|
||||
version_added: 2.3.0
|
||||
return_code:
|
||||
description: The command status code. This attribute is depricated and will remove in future release. Please use rc instead.
|
||||
type: int
|
||||
'''
|
||||
|
||||
import copy
|
||||
@@ -183,6 +188,7 @@ def execute_module(module, k8s_ansible_mixin):
|
||||
changed=True,
|
||||
stdout="".join(stdout),
|
||||
stderr="".join(stderr),
|
||||
rc=rc,
|
||||
return_code=rc
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user