From 306a6a751f60da84c0079755570413ceee685194 Mon Sep 17 00:00:00 2001 From: Sascha Marcel Schmidt Date: Sun, 8 Jul 2018 13:16:25 +0200 Subject: [PATCH] wait for job to complete --- .../heketi/roles/provision/tasks/setup/storage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml index e84303d3e..16b300600 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml @@ -15,6 +15,8 @@ - "heketi_storage_state.stdout|from_json|json_query(endpoints_query)|length == 0" - "heketi_storage_state.stdout|from_json|json_query(service_query)|length == 0" - "heketi_storage_state.stdout|from_json|json_query(job_query)|length == 0" + register: "heketi_storage_result" +- debug: { var: "heketi_storage_result" } - command: "kubectl get secrets,endpoints,services,jobs --output=json" register: "heketi_storage_state" - name: "Get state of heketi storage service, endpoint, secret and job." @@ -25,7 +27,7 @@ secret_query: "items[?metadata.name=='heketi-storage-secret' && kind=='Secret']" endpoints_query: "items[?metadata.name=='heketi-storage-endpoints' && kind=='Endpoints']" service_query: "items[?metadata.name=='heketi-storage-endpoints' && kind=='Service']" - job_query: "items[?metadata.name=='heketi-storage-copy-job' && kind=='Job' && status.active==0]" + job_query: "items[?metadata.name=='heketi-storage-copy-job' && kind=='Job' && status.conditions[?type=='Complete'].status=='True']" until: - "heketi_storage_state.stdout|from_json|json_query(secret_query)|length == 1" - "heketi_storage_state.stdout|from_json|json_query(endpoints_query)|length == 1"