Merge "Add abrmd readiness check script to base"
authorGirish Havaldar <hg0071052@techmahindra.com>
Thu, 27 Sep 2018 08:22:00 +0000 (08:22 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 27 Sep 2018 08:22:00 +0000 (08:22 +0000)
bin/base/abrmd_ready.sh [new file with mode: 0755]
bin/base/xenialdockerfile

diff --git a/bin/base/abrmd_ready.sh b/bin/base/abrmd_ready.sh
new file mode 100755 (executable)
index 0000000..37fe541
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Script to check if abrmd is ready
+# This will be called in initContainers in Kubernetes
+# Takes a seconds parameter that will time out the script
+
+timeout=$1
+start=$SECONDS
+tpm2_listpcrs -T tabrmd >/dev/null
+ret=$?
+
+while [ $ret -ne 0 ]
+do
+  if (($SECONDS-$start > $timeout))
+  then
+    echo "$0 timed out after $timeout seconds"
+    break
+  fi
+
+  sleep 10
+  tpm2_listpcrs -T tabrmd >/dev/null
+  ret=$?
+done
index b786541..7915444 100644 (file)
@@ -106,3 +106,4 @@ RUN mkdir -p /sshsm/bin
 COPY ./import.sh /sshsm/bin
 COPY ./softhsmconfig.sh /sshsm/bin
 COPY ./application.sh /sshsm/bin
+COPY ./abrmd_ready.sh /sshsm/bin