summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2018-09-25 15:17:52 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2018-09-26 21:07:49 +0000
commitdd4e9db0294f028f7ebc465238a848f75ea3c06a (patch)
tree52b574283ef423a37a358250de85a3b04ab410e6
parent67e6b6dd230ccb83204d2d103a033f735c83a14f (diff)
Add abrmd readiness check script to base
Testca and any other container that depends on abrmd needs a script to check if it is up and ready to accept commands. This scripts addresses that via the tpm2_listpcrs command. Issue-ID: AAF-520 Change-Id: I432b6f16a78d8eb6f18118ca64f040a70b2cab25 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
-rwxr-xr-xbin/base/abrmd_ready.sh23
-rw-r--r--bin/base/xenialdockerfile1
2 files changed, 24 insertions, 0 deletions
diff --git a/bin/base/abrmd_ready.sh b/bin/base/abrmd_ready.sh
new file mode 100755
index 0000000..37fe541
--- /dev/null
+++ b/bin/base/abrmd_ready.sh
@@ -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
diff --git a/bin/base/xenialdockerfile b/bin/base/xenialdockerfile
index b786541..7915444 100644
--- a/bin/base/xenialdockerfile
+++ b/bin/base/xenialdockerfile
@@ -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