You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
At the moment if you run k8s_exec and the command returns a non 0 status code the task still returns a successful change. I think it should return an error.
ISSUE TYPE
Feature Idea
COMPONENT NAME
k8s_exec
ADDITIONAL INFORMATION
This could solve issues for playbooks where commands could possibly fail, and carry on unknowningly.
- name: Cause an exit code by using command 'false'community.kubernetes.k8s_exec:
namespace: defaultpod: "mypodname"command: "false"
- name: This should never fire due to the error above.....
@Yantrio I added rc in k8s_exec which returns the status code of the command, but this is changing the behavior of the module. Since we are rc affects ansible task status. Let me know if you want a toggle switch to enable this feature or not.
SUMMARY
At the moment if you run k8s_exec and the command returns a non 0 status code the task still returns a successful change. I think it should return an error.
ISSUE TYPE
COMPONENT NAME
k8s_exec
ADDITIONAL INFORMATION
This could solve issues for playbooks where commands could possibly fail, and carry on unknowningly.
My python isn't too amazing, and I'm not familiar with the python kubernetes client, but it looks like we could utillize something similar to this https://github.com/kubernetes-client/python-base/pull/160/files in the part that parses the stream in k8s_exec here:
community.kubernetes/plugins/modules/k8s_exec.py
Lines 135 to 142 in 18dfb68
Due to this being released already also, this may have to be behind a property as to not break existing functionality in playbooks out there already.
I may try at implementing this and I'll put in a PR if I'm successful.
The text was updated successfully, but these errors were encountered: