mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-03-26 21:33:02 +00:00
Adding sleep 0 as workaround when copying files with kubectl exec (#378)
Adding sleep 0 as workaround when copying files with kubectl exec SUMMARY For all the commands executed remotely, ** && sleep 0** will be appended as a workaround for all the commands to terminate properly:16def8050a/lib/ansible/plugins/action/__init__.py (L1243)Workaround will be applied in case of kubectl exec too: kubernetes.core/plugins/connection/kubectl.py Line 300 inb19ff9dsuper(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) That is not the case in the case of the file copy executed by using kubectl exec, therefore it is possible for the kubectl exec to terminate before dd finishes properly causing the file to be truncated. ISSUE TYPE Bugfix Pull Request COMPONENT NAME changelogs/fragments/321-kubectl_sleep.yml plugins/connection/kubectl.py
This commit is contained in:
3
changelogs/fragments/321-kubectl_sleep.yml
Normal file
3
changelogs/fragments/321-kubectl_sleep.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
minor_changes:
|
||||
- kubectl - wait for dd command to complete before proceeding (https://github.com/ansible-collections/kubernetes.core/pull/321).
|
||||
@@ -355,7 +355,7 @@ class Connection(ConnectionBase):
|
||||
[
|
||||
self._play_context.executable,
|
||||
"-c",
|
||||
"dd of=%s bs=%s%s" % (out_path, BUFSIZE, count),
|
||||
"dd of=%s bs=%s%s && sleep 0" % (out_path, BUFSIZE, count),
|
||||
]
|
||||
)
|
||||
args = [to_bytes(i, errors="surrogate_or_strict") for i in args]
|
||||
|
||||
Reference in New Issue
Block a user