Updated Branches: refs/heads/4.1 77d65b3e0 -> 6a19da78c
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.(cherry picked from commit cb6b96cda22dbdb7a1fe636ec2f7de6664aaf8ec) Signed-off-by: Hugo Trippaers <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6a19da78 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6a19da78 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6a19da78 Branch: refs/heads/4.1 Commit: 6a19da78c3ef0cf21c665930906a65980ffb136a Parents: b920a39 Author: Hugo Trippaers <[email protected]> Authored: Tue Feb 5 20:48:23 2013 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Tue Feb 5 21:14:34 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/6a19da78/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) {
