mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-08 22:12:44 +00:00
ansible sanity for k8s_cp (#183)
This commit is contained in:
@@ -67,7 +67,7 @@ def execute_module(module):
|
||||
content = ""
|
||||
count = 0
|
||||
while len(content) < size:
|
||||
content += f"This file has been generated using ansible: {count}\n"
|
||||
content += "This file has been generated using ansible: {0}\n".format(count)
|
||||
count += 1
|
||||
|
||||
with open(path, write_mode) as f:
|
||||
|
||||
@@ -166,7 +166,9 @@ def execute_module(module):
|
||||
pod_rc, pod_out, pod_err = kubectl_run_from_pod(module)
|
||||
rc, out, err = module.run_command([module.params.get('local_path')] + args)
|
||||
if rc == pod_rc and out == pod_out:
|
||||
module.exit_json(msg=f"{local_path} and {namespace}/{pod}:{file} are same.", rc=rc, stderr=err, stdout=out)
|
||||
module.exit_json(msg="{0} and {1}/{2}:{3} are same.".format(
|
||||
local_path, namespace, pod, file
|
||||
), rc=rc, stderr=err, stdout=out)
|
||||
result = dict(local=dict(rc=rc, out=out, err=err), remote=dict(rc=pod_rc, out=pod_out, err=pod_err))
|
||||
module.fail_json(msg=f"{local_path} and {namespace}/{pod}:{file} are same.", **result)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user