[VOL-3814] Waiting for a component to be active before pushing config

Change-Id: I0ad49eb8f553d9cb1289edb6b74c710cae7e0bfd
diff --git a/voltha-infra/Chart.yaml b/voltha-infra/Chart.yaml
index 4881ec8..b68a668 100644
--- a/voltha-infra/Chart.yaml
+++ b/voltha-infra/Chart.yaml
@@ -29,7 +29,7 @@
 name: voltha-infra
 
 appVersion: "1.0"
-version: 0.1.2
+version: 0.1.3
 
 dependencies:
   - name: onos-classic
diff --git a/voltha-infra/templates/onos-config-loader-script.yaml b/voltha-infra/templates/onos-config-loader-script.yaml
index 9132c85..25c6d0a 100644
--- a/voltha-infra/templates/onos-config-loader-script.yaml
+++ b/voltha-infra/templates/onos-config-loader-script.yaml
@@ -28,6 +28,12 @@
     CFGS=$(ls /opt/configs | grep -v netcfg.json);
     for CFG in ${CFGS};
     do
-      echo -e "Loading $CFG config"
+      echo -e "Check that component $CFG is active";
+      until curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X GET "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/configuration/$CFG";
+      do
+        echo -e "Waiting for $CFG to be active";
+        sleep 5;
+      done
+      echo -e "Loading $CFG config";
       curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X POST "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/configuration/$CFG" -H Content-type:application/json -d @/opt/configs/$CFG;
     done