diff --git a/configuration/environments_scripts/repo/usr/local/bin/sync-repo-and-execute-cmd.sh b/configuration/environments_scripts/repo/usr/local/bin/sync-repo-and-execute-cmd.sh index 78f0552ff08..34468f2fba4 100755 --- a/configuration/environments_scripts/repo/usr/local/bin/sync-repo-and-execute-cmd.sh +++ b/configuration/environments_scripts/repo/usr/local/bin/sync-repo-and-execute-cmd.sh @@ -53,6 +53,6 @@ then if httpd -t ; then ${COMMAND_ON_COMPLETION} else - echo "Config error" + logger -t httpdMerge "Config error" fi fi \ No newline at end of file diff --git a/java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/ApacheReverseProxy.java b/java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/ApacheReverseProxy.java index 691bb5de914..f58b0bb40b5 100755 --- a/java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/ApacheReverseProxy.java +++ b/java/com.sap.sse.landscape.aws/src/com/sap/sse/landscape/aws/impl/ApacheReverseProxy.java @@ -164,7 +164,7 @@ implements com.sap.sse.landscape.Process { /** * Creates a command, that can be ran on an instance to commit, and optionally push, changes to a file (within a git repository). ASSUMES the command is ran from within the repository. - * @param editedFileName The file name edited, created or deleted to commit. This includes the {@link #CONFIG_FILE_EXTENSION}, but not a path. We append the relative path. + * @param editedFileName The file name edited, created or deleted to commit. This includes the {@link #CONFIG_FILE_EXTENSION}, but not a path. The method appends the relative path. * @param commitMsg The commit message, without escaped speech marks. * @param performPush Boolean indicating whether to push changes or not. True for performing a push. * @return Returns the created command (in String form) to perform a commit and optional push. @@ -268,18 +268,16 @@ implements com.sap.sse.landscape.Process { */ private void removeRedirect(String configFileName, String hostname, Optional optionalKeyName, byte[] privateKeyEncryptionPassphrase) throws Exception { - StringBuilder command = new StringBuilder("cd " + CONFIG_REPO_PATH ); + StringBuilder command = new StringBuilder("su - " + CONFIG_USER + " -c '"); // The Git commit must be ran as the CONFIG_USER. + command.append("cd "); + command.append(CONFIG_REPO_PATH); command.append(" && git checkout "); command.append(CONFIG_REPO_MAIN_BRANCH_NAME); command.append(" && rm "); command.append(getRelativeConfigFilePath(configFileName)); - command.append(" && service httpd reload; " ); - command.append("su - " + CONFIG_USER + " -c '"); // The Git commit must be ran as the CONFIG_USER. - command.append("cd "); - command.append(CONFIG_REPO_PATH); command.append("; "); command.append(createCommitAndPushString(configFileName, "Removed " + hostname, /* Perform push */ true)); - command.append("'"); + command.append("'; service httpd reload;"); // ' closes the su. The reload must be run as the root user. logger.info("Standard output from removing the re-direct for " + hostname + " and reloading the Apache httpd server: " + runCommandAndReturnStdoutAndStderr(command.toString(),