summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2018-06-21 10:17:58 -0400
committerTim Rozet <trozet@redhat.com>2018-06-21 10:17:58 -0400
commit0f74128709ef7f1840ee2af673067c3712f2393b (patch)
tree92f725745e9a99ccfbffba0754b692fd87ea1d1d
parent585ae3468c2c7dc1387687bf5e71a9d61c6b15c7 (diff)
Fix gpg import error when node has no key
For some servers like lf-virtual3 there is no key locally or one remotely. In that case we do not want the import script to fail the job, like in: https://build.opnfv.org/ci/job/apex-upload-snapshot/1/console Change-Id: I13ddfdb45cd2d60bd911fa590bf9bf54bd288ba8 Signed-off-by: Tim Rozet <trozet@redhat.com>
-rwxr-xr-xutils/gpg_import_key.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/utils/gpg_import_key.sh b/utils/gpg_import_key.sh
index f45e40919..94ffbaab5 100755
--- a/utils/gpg_import_key.sh
+++ b/utils/gpg_import_key.sh
@@ -51,10 +51,14 @@ else
if [ -z "$NODE_NAME" ];
then echo "Cannot find node name"
exit 0
- else echo "Importing key for '$NODE_NAME'";
- gsutil cp gs://opnfv-signing-keys/"$NODE_NAME"-subkey .
- gpg2 --import "$NODE_NAME"-subkey
- rm -f "$NODE_NAME"-subkey
- fi
+ elif gsutil ls gs://opnfv-signing-keys | grep $NODE_NAME; then
+ echo "Importing key for '$NODE_NAME'"
+ gsutil cp gs://opnfv-signing-keys/"$NODE_NAME"-subkey .
+ gpg2 --import "$NODE_NAME"-subkey
+ rm -f "$NODE_NAME"-subkey
+ else
+ echo "No keys found locally or remotely for host, skipping import"
+ exit 0
+ fi
fi