mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
764ee30ecc
commit
ab9a0fd69f
|
|
@ -147,7 +147,7 @@ public class EncryptionSecretKeyChanger {
|
||||||
{
|
{
|
||||||
bwriter.write(newMSKey);
|
bwriter.write(newMSKey);
|
||||||
} catch (IOException e) {
|
} 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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,11 @@ for example:
|
||||||
|
|
||||||
def saveMgmtServerSecretKey():
|
def saveMgmtServerSecretKey():
|
||||||
if self.encryptiontype == 'file':
|
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):
|
def formatEncryptResult(value):
|
||||||
return 'ENC(%s)'%value
|
return 'ENC(%s)'%value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue