Skip to content

Commit

Permalink
enable to start script IAs with and without sudo available
Browse files Browse the repository at this point in the history
  • Loading branch information
zimmerml committed Aug 15, 2018
1 parent 6be09f1 commit fdfb207
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,26 @@ public Exchange invoke(final Exchange exchange) {
artifactTypeSpecificCommand =
artifactTypeSpecificCommand.replace(ManagementBusPluginRemoteServiceImpl.PLACEHOLDER_TARGET_FILE_NAME_WITHOUT_EXTENSION,
fileNameWithoutE);
// hacky check if sudo is available or not
artifactTypeSpecificCommand =
artifactTypeSpecificCommand.replace(ManagementBusPluginRemoteServiceImpl.PLACEHOLDER_DA_NAME_PATH_MAP,
"sudo -E "
"CAN_SUDO=$(sudo -n uptime 2>&1|grep \"load\"|wc -l)\r\n"
+ "if [ ${CAN_SUDO} -gt 0 ]\r\n" + "then\r\n"
+ "sudo -E "
+ createDANamePathMapEnvVar(csarID,
serviceTemplateID,
nodeTypeID,
nodeTemplateID)
+ " CSAR='" + csarID + "' NodeInstanceID='"
+ "CSAR='" + csarID + "' NodeInstanceID='"
+ nodeInstanceID + "' ServiceInstanceID='"
+ serviceInstanceID + "' ");
+ serviceInstanceID + "'\r\n" + "else\r\n"
+ createDANamePathMapEnvVar(csarID,
serviceTemplateID,
nodeTypeID,
nodeTemplateID)
+ "CSAR='" + csarID + "' NodeInstanceID='"
+ nodeInstanceID + "' ServiceInstanceID='"
+ serviceInstanceID + "'\r\n" + "fi\r\n");
artifactTypeSpecificCommand =
artifactTypeSpecificCommand.replace(ManagementBusPluginRemoteServiceImpl.PLACEHOLDER_DA_INPUT_PARAMETER,
createParamsString(params));
Expand Down

0 comments on commit fdfb207

Please sign in to comment.