CLOUDSTACK-1362: Put a workaround fix to set excutable attribute of injectkys.sh at runtime

This commit is contained in:
Kelven Yang 2013-02-21 14:32:47 -08:00
parent 7602997b90
commit 72e6fd6e8d

View File

@ -151,6 +151,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
@DB
public void persistDefaultValues() throws InternalErrorException {
fixupScriptFileAttribute();
// Create system user and admin user
saveUser();
@ -703,6 +705,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");