Skip to content

Commit 5cd3608

Browse files
committed
Remove the chmod solution and replace with an explicit call to
/bin/bash. This way the file will only need read permissions.
1 parent a0b5ebc commit 5cd3608

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

‎server/src/com/cloud/server/ConfigurationServerImpl.java‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ public boolean configure(String name, Map<String, Object> params)
148148
@DB
149149
public void persistDefaultValues() throws InternalErrorException {
150150

151-
fixupScriptFileAttribute();
152-
153151
// Create system user and admin user
154152
saveUser();
155153

@@ -701,24 +699,6 @@ private void writeKeyToDisk(String key, String keyPath) {
701699

702700
}
703701

704-
private void fixupScriptFileAttribute() {
705-
// TODO : this is a hacking fix to workaround that executable bit is not preserved in WAR package
706-
String scriptPath = Script.findScript("", "scripts/vm/systemvm/injectkeys.sh");
707-
if(scriptPath != null) {
708-
File file = new File(scriptPath);
709-
if(!file.canExecute()) {
710-
s_logger.info("Some of the shell script files may not have executable bit set. Fixup...");
711-
712-
String cmd = "sudo chmod ugo+x " + scriptPath;
713-
s_logger.info("Executing " + cmd);
714-
String result = Script.runSimpleBashScript(cmd);
715-
if (result != null) {
716-
s_logger.warn("Failed to fixup shell script executable bits " + result);
717-
}
718-
}
719-
}
720-
}
721-
722702
private void updateKeyPairsOnDisk(String homeDir) {
723703
File keyDir = new File(homeDir + "/.ssh");
724704
Boolean devel = Boolean.valueOf(_configDao.getValue("developer"));
@@ -749,7 +729,7 @@ protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String pr
749729
if (systemVmIsoPath == null) {
750730
throw new CloudRuntimeException("Unable to find systemvm iso vms/systemvm.iso");
751731
}
752-
final Script command = new Script(scriptPath, s_logger);
732+
final Script command = new Script("/bin/bash " + scriptPath, s_logger);
753733
command.add(publicKeyPath);
754734
command.add(privKeyPath);
755735
command.add(systemVmIsoPath);

0 commit comments

Comments
 (0)