mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-07 13:32:37 +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:
2
changelogs/fragments/230-k8sexec-has-new-returnvalue.yml
Normal file
2
changelogs/fragments/230-k8sexec-has-new-returnvalue.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- k8s_exec - fix k8s_exec returning rc attribute, to follow ansible's common return values (https://github.com/ansible-collections/kubernetes.core/pull/230).
|
||||||
@@ -382,7 +382,7 @@ Notes
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
- Return code ``return_code`` for the command executed is added in output in version 1.0.0.
|
- Return code ``rc`` 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.
|
- The authenticated user must have at least read access to the pods resource and write access to the pods/exec resource.
|
||||||
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ Examples
|
|||||||
- name: Check last command status
|
- name: Check last command status
|
||||||
debug:
|
debug:
|
||||||
msg: "cmd failed"
|
msg: "cmd failed"
|
||||||
when: command_status.return_code != 0
|
when: command_status.rc != 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -441,6 +441,23 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
|||||||
<br/>
|
<br/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>rc</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">integer</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<div>The command status code</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="elbow-placeholder"> </td>
|
<td class="elbow-placeholder"> </td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
@@ -453,7 +470,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
|||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<div>The command status code</div>
|
<div>The command status code. This attribute is deprecated and will be removed in future release. Please use rc instead.</div>
|
||||||
<br/>
|
<br/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
- name: Check last command status
|
- name: Check last command status
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
|
- command_status.rc != 0
|
||||||
- command_status.return_code != 0
|
- command_status.return_code != 0
|
||||||
|
|
||||||
always:
|
always:
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ requirements:
|
|||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
|
|
||||||
notes:
|
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.
|
- 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.
|
- 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
|
- name: Check last command status
|
||||||
debug:
|
debug:
|
||||||
msg: "cmd failed"
|
msg: "cmd failed"
|
||||||
when: command_status.return_code != 0
|
when: command_status.rc != 0
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
@@ -104,9 +105,13 @@ result:
|
|||||||
stderr_lines:
|
stderr_lines:
|
||||||
description: The command stderr
|
description: The command stderr
|
||||||
type: str
|
type: str
|
||||||
return_code:
|
rc:
|
||||||
description: The command status code
|
description: The command status code
|
||||||
type: int
|
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
|
import copy
|
||||||
@@ -183,6 +188,7 @@ def execute_module(module, k8s_ansible_mixin):
|
|||||||
changed=True,
|
changed=True,
|
||||||
stdout="".join(stdout),
|
stdout="".join(stdout),
|
||||||
stderr="".join(stderr),
|
stderr="".join(stderr),
|
||||||
|
rc=rc,
|
||||||
return_code=rc
|
return_code=rc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user