k8s_exec: Return rc for the command executed (#158)

k8s_exec now returns command return code in output.

Fixes: #122

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde
2020-07-23 10:52:26 +05:30
committed by GitHub
parent 6c059bd2bc
commit 3aaf182c30
3 changed files with 65 additions and 4 deletions

View File

@@ -43,6 +43,19 @@
that:
- "'nameserver' in output.stdout"
- name: Check if rc is returned for the given command
k8s_exec:
namespace: "{{ exec_namespace }}"
pod: "{{ pod }}"
command: 'false'
register: command_status
ignore_errors: True
- name: Check last command status
assert:
that:
- command_status.return_code != 0
always:
- name: "Cleanup namespace"
k8s: