Updated Branches: refs/heads/master 3535f88d1 -> cb6b96cda
Summary: Path changes for new rpm packaging The path to the keyfile was hardcoded, so added an alternative path for compatibility with the packaging locations. Should ideally become a setting in the config file. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/cb6b96cd Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/cb6b96cd Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/cb6b96cd Branch: refs/heads/master Commit: cb6b96cda22dbdb7a1fe636ec2f7de6664aaf8ec Parents: 3535f88 Author: Hugo Trippaers <[email protected]> Authored: Tue Feb 5 20:48:23 2013 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Tue Feb 5 20:49:02 2013 +0100 ---------------------------------------------------------------------- .../utils/crypt/EncryptionSecretKeyChecker.java | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/cb6b96cd/utils/src/com/cloud/utils/crypt/EncryptionSecretKeyChecker.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/crypt/EncryptionSecretKeyChecker.java b/utils/src/com/cloud/utils/crypt/EncryptionSecretKeyChecker.java index 63f841d..c717a3a 100755 --- a/utils/src/com/cloud/utils/crypt/EncryptionSecretKeyChecker.java +++ b/utils/src/com/cloud/utils/crypt/EncryptionSecretKeyChecker.java @@ -45,7 +45,9 @@ public class EncryptionSecretKeyChecker extends AdapterBase implements SystemInt private static final Logger s_logger = Logger.getLogger(EncryptionSecretKeyChecker.class); - private static final String s_keyFile = "/etc/cloud/management/key"; + // Two possible locations with the new packaging naming + private static final String s_altKeyFile = "/etc/cloud/management/key"; + private static final String s_keyFile = "/etc/cloudstack/management/key"; private static final String s_envKey = "CLOUD_SECRET_KEY"; private static StandardPBEStringEncryptor s_encryptor = new StandardPBEStringEncryptor(); private static boolean s_useEncryption = false; @@ -76,8 +78,12 @@ public class EncryptionSecretKeyChecker extends AdapterBase implements SystemInt SimpleStringPBEConfig stringConfig = new SimpleStringPBEConfig(); if(encryptionType.equals("file")){ + File keyFile = new File(s_keyFile); + if (!keyFile.exists()) { + keyFile = new File(s_altKeyFile); + } try { - BufferedReader in = new BufferedReader(new FileReader(s_keyFile)); + BufferedReader in = new BufferedReader(new FileReader(keyFile)); secretKey = in.readLine(); //Check for null or empty secret key } catch (FileNotFoundException e) {
