This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.17
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.17 by this push:
new ab9a0fd69f Updated log message and throw error when unable to update
the secret key file (#6542)
ab9a0fd69f is described below
commit ab9a0fd69f5af774dbed51d3827c3395224f0ec5
Author: Harikrishna <[email protected]>
AuthorDate: Sat Jul 9 21:21:11 2022 +0530
Updated log message and throw error when unable to update the secret key
file (#6542)
This PR fixes issue #6232 to update the error message and throw the error
when updating key file is failed. This helps to find out the proper reason for
failure, mainly with umask.
---
.../main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java | 2 +-
setup/bindir/cloud-setup-databases.in | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git
a/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java
b/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java
index ae103ff34f..a958d4ada7 100644
---
a/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java
+++
b/framework/db/src/main/java/com/cloud/utils/crypt/EncryptionSecretKeyChanger.java
@@ -147,7 +147,7 @@ public class EncryptionSecretKeyChanger {
{
bwriter.write(newMSKey);
} catch (IOException e) {
- System.out.println("Failed to write new secret to
file. Please update the file manually");
+ System.out.println(String.format("Please update the
file %s manually. Failed to write new secret to file with error %s", keyFile,
e.getMessage()));
}
}
}
diff --git a/setup/bindir/cloud-setup-databases.in
b/setup/bindir/cloud-setup-databases.in
index 37b696f9fc..0532613dd8 100755
--- a/setup/bindir/cloud-setup-databases.in
+++ b/setup/bindir/cloud-setup-databases.in
@@ -397,7 +397,11 @@ for example:
def saveMgmtServerSecretKey():
if self.encryptiontype == 'file':
- open(self.encryptionKeyFile, 'w').write(self.mgmtsecretkey)
+ try:
+ open(self.encryptionKeyFile, 'w').write(self.mgmtsecretkey)
+ except IOError as e:
+ msg = "Failed to save management server secret key file %s
due to %s, also please check the default umask"%(self.encryptionKeyFile,
e.strerror)
+ self.errorAndExit(msg)
def formatEncryptResult(value):
return 'ENC(%s)'%value