mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-1362: Put a workaround fix to set excutable attribute of injectkys.sh at runtime
This commit is contained in:
parent
7602997b90
commit
72e6fd6e8d
@ -151,6 +151,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||||||
@DB
|
@DB
|
||||||
public void persistDefaultValues() throws InternalErrorException {
|
public void persistDefaultValues() throws InternalErrorException {
|
||||||
|
|
||||||
|
fixupScriptFileAttribute();
|
||||||
|
|
||||||
// Create system user and admin user
|
// Create system user and admin user
|
||||||
saveUser();
|
saveUser();
|
||||||
|
|
||||||
@ -704,6 +706,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) {
|
private void updateKeyPairsOnDisk(String homeDir) {
|
||||||
File keyDir = new File(homeDir + "/.ssh");
|
File keyDir = new File(homeDir + "/.ssh");
|
||||||
if (!keyDir.isDirectory()) {
|
if (!keyDir.isDirectory()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user