From 0f74128709ef7f1840ee2af673067c3712f2393b Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Thu, 21 Jun 2018 10:17:58 -0400 Subject: 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 --- utils/gpg_import_key.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'utils') 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 -- cgit 1.2.3-korg