Updated Branches: refs/heads/4.1 aea5b268b -> e219ef951
CLOUDSTACK-1362: Put a workaround fix to set excutable attribute of injectkys.sh at runtime Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e219ef95 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e219ef95 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e219ef95 Branch: refs/heads/4.1 Commit: e219ef951bee8ce004129e47983e966766b19e74 Parents: aea5b26 Author: Kelven Yang <[email protected]> Authored: Thu Feb 21 14:32:47 2013 -0800 Committer: Kelven Yang <[email protected]> Committed: Thu Feb 21 14:32:47 2013 -0800 ---------------------------------------------------------------------- .../com/cloud/server/ConfigurationServerImpl.java | 20 +++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e219ef95/server/src/com/cloud/server/ConfigurationServerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 6bf7f95..294bd6a 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -152,6 +152,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio @DB public void persistDefaultValues() throws InternalErrorException { + fixupScriptFileAttribute(); + // Create system user and admin user saveUser(); @@ -702,6 +704,24 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio } } + + private void fixupScriptFileAttribute() { + // TODO : this is a hacking fix to workaround that executable bit is not preserved in WAR package + String scriptPath = Script.findScript("", "scripts/vm/systemvm/injectkeys.sh"); + if(scriptPath != null) { + File file = new File(scriptPath); + if(!file.canExecute()) { + s_logger.info("Some of the shell script files may not have executable bit set. Fixup..."); + + String cmd = "chmod ugo+x " + scriptPath; + s_logger.info("Executing " + cmd); + String result = Script.runSimpleBashScript(cmd); + if (result != null) { + s_logger.warn("Failed to fixup shell script executable bits " + result); + } + } + } + } private void updateKeyPairsOnDisk(String homeDir) { File keyDir = new File(homeDir + "/.ssh");
