From 0c6fed40c501f5768d532e4a9dd2a566552058a8 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Thu, 9 Jan 2020 23:24:11 +0100 Subject: [PATCH 1/5] Update message when keys are NOT being injected --- scripts/vm/systemvm/injectkeys.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vm/systemvm/injectkeys.sh b/scripts/vm/systemvm/injectkeys.sh index b66b8b5f77ef..c5014517d892 100755 --- a/scripts/vm/systemvm/injectkeys.sh +++ b/scripts/vm/systemvm/injectkeys.sh @@ -45,7 +45,7 @@ inject_into_iso() { [ ! -f $isofile ] && echo "$(basename $0): Could not find systemvm iso patch file $isofile" && return 1 bsdtar -C $MOUNTPATH -xf $isofile [ $? -ne 0 ] && echo "$(basename $0): Failed to extract original iso $isofile" && clean_up && return 1 - diff -q $MOUNTPATH/authorized_keys $newpubkey &> /dev/null && clean_up && return 0 + diff -q $MOUNTPATH/authorized_keys $newpubkey &> /dev/null && echo "New public key is the same as the one in the systemvm.iso, not injecting it, not modifying systemvm.iso" && clean_up && return 0 backup_iso [ $? -ne 0 ] && echo "$(basename $0): Failed to backup original iso $isofile" && clean_up && return 1 $SUDO cp $newpubkey $MOUNTPATH/authorized_keys From a40d800314bd05ac8a45598120db8cc6d0d52f12 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Thu, 9 Jan 2020 23:35:32 +0100 Subject: [PATCH 2/5] Correct the message after injectkeys.ssh is done --- .../src/main/java/com/cloud/server/ConfigurationServerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index 635b482d60a4..2d4f223e2f19 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -767,7 +767,7 @@ protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String pr command.add(systemVmIsoPath); final String result = command.execute(); - s_logger.info("Injected public and private keys into systemvm iso with result : " + result); + s_logger.info("Injected new public key into systemvm iso with result : " + result); if (result != null) { s_logger.warn("Failed to inject generated public key into systemvm iso " + result); throw new CloudRuntimeException("Failed to inject generated public key into systemvm iso " + result); From 75aa89871a1a9289e4f99298d08103ac152aaad9 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Thu, 9 Jan 2020 23:41:27 +0100 Subject: [PATCH 3/5] Update message to a more meaningful one, since sometimes nothing is injected --- .../src/main/java/com/cloud/server/ConfigurationServerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index 2d4f223e2f19..75d1a6b3d139 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -767,7 +767,7 @@ protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String pr command.add(systemVmIsoPath); final String result = command.execute(); - s_logger.info("Injected new public key into systemvm iso with result : " + result); + s_logger.info("The script injectkeys.sh was run with result : " + result); if (result != null) { s_logger.warn("Failed to inject generated public key into systemvm iso " + result); throw new CloudRuntimeException("Failed to inject generated public key into systemvm iso " + result); From e8d339589e147393982fe51f8f25e9574d133035 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Thu, 9 Jan 2020 23:43:13 +0100 Subject: [PATCH 4/5] Update other 2 --- .../main/java/com/cloud/server/ConfigurationServerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index 75d1a6b3d139..d09be9e50780 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -769,8 +769,8 @@ protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String pr final String result = command.execute(); s_logger.info("The script injectkeys.sh was run with result : " + result); if (result != null) { - s_logger.warn("Failed to inject generated public key into systemvm iso " + result); - throw new CloudRuntimeException("Failed to inject generated public key into systemvm iso " + result); + s_logger.warn("The script injectkeys.sh failed to run sucessfully : " + result); + throw new CloudRuntimeException("The script injectkeys.sh failed to run sucessfully : " + result); } } From 2e78f2840fbf36f483c9bdd88bdd25166e502171 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Thu, 9 Jan 2020 23:44:23 +0100 Subject: [PATCH 5/5] typo --- .../main/java/com/cloud/server/ConfigurationServerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index d09be9e50780..1d5b5821b467 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -769,8 +769,8 @@ protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String pr final String result = command.execute(); s_logger.info("The script injectkeys.sh was run with result : " + result); if (result != null) { - s_logger.warn("The script injectkeys.sh failed to run sucessfully : " + result); - throw new CloudRuntimeException("The script injectkeys.sh failed to run sucessfully : " + result); + s_logger.warn("The script injectkeys.sh failed to run successfully : " + result); + throw new CloudRuntimeException("The script injectkeys.sh failed to run successfully : " + result); } }