Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.solace.maas.ep.event.management.agent.plugin.command.model.CommandRequest;
import com.solace.maas.ep.event.management.agent.plugin.command.model.CommandResult;
import com.solace.maas.ep.event.management.agent.plugin.command.model.JobStatus;
import com.solace.maas.ep.event.management.agent.plugin.common.util.EnvironmentUtil;
import com.solace.maas.ep.event.management.agent.plugin.service.MessagingServiceDelegateService;
import com.solace.maas.ep.event.management.agent.plugin.solace.processor.semp.SempClient;
import com.solace.maas.ep.event.management.agent.plugin.solace.processor.semp.SolaceHttpSemp;
Expand Down Expand Up @@ -53,6 +54,7 @@
@Slf4j
@Service
@ConditionalOnProperty(name = "event-portal.gateway.messaging.standalone", havingValue = "false")
@SuppressWarnings({"PMD.GodClass"})
public class CommandManager {
public static final String ERROR_EXECUTING_COMMAND = "Error executing command";
private final TerraformManager terraformManager;
Expand All @@ -66,6 +68,7 @@ public class CommandManager {
private final SempPatchCommandManager sempPatchCommandManager;
private final SempGetCommandManager sempGetCommandManager;
private final TerraformLogProcessingService terraformLoggingService;
private final EnvironmentUtil environmentUtil;

public CommandManager(TerraformManager terraformManager,
CommandMapper commandMapper,
Expand All @@ -77,7 +80,8 @@ public CommandManager(TerraformManager terraformManager,
final SempDeleteCommandManager sempDeleteCommandManager,
TerraformLogProcessingService terraformLoggingService,
SempPatchCommandManager sempPatchCommandManager,
SempGetCommandManager sempGetCommandManager) {
SempGetCommandManager sempGetCommandManager,
EnvironmentUtil environmentUtil) {
this.terraformManager = terraformManager;
this.commandMapper = commandMapper;
this.commandPublisher = commandPublisher;
Expand All @@ -90,6 +94,7 @@ public CommandManager(TerraformManager terraformManager,
this.terraformLoggingService = terraformLoggingService;
this.sempPatchCommandManager = sempPatchCommandManager;
this.sempGetCommandManager = sempGetCommandManager;
this.environmentUtil = environmentUtil;
}

public void execute(CommandMessage request) {
Expand All @@ -116,6 +121,10 @@ public void handleError(Exception e, CommandMessage message) {

@SuppressWarnings("PMD")
private void configPush(CommandRequest request) {

if (environmentUtil.isCustomCACertPresent()) {
log.info("Custom CA certificates present. Using combined truststore with default and custom CA certificates for configPush operation.");
}
List<Path> executionLogFilesToClean = new ArrayList<>();
boolean attachErrorToTerraformCommand = false;
try {
Expand All @@ -136,6 +145,7 @@ private void configPush(CommandRequest request) {
log.info("Skipping TLS verification for config push to serviceId {}.", request.getServiceId());
}


for (CommandBundle bundle : request.getCommandBundles()) {
boolean exitEarlyOnFailedCommand = bundle.getExitOnFailure();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.solace.maas.ep.common.messages.ScanStatusMessage;
import com.solace.maas.ep.common.model.ScanType;
import com.solace.maas.ep.event.management.agent.config.eventPortal.EventPortalProperties;
import com.solace.maas.ep.event.management.agent.plugin.common.util.EnvironmentUtil;
import com.solace.maas.ep.event.management.agent.plugin.constants.RouteConstants;
import com.solace.maas.ep.event.management.agent.plugin.constants.ScanStatus;
import com.solace.maas.ep.event.management.agent.plugin.manager.loader.PluginLoader;
Expand Down Expand Up @@ -46,19 +47,25 @@ public class ScanManager {
// This is an optional dependency since it is not available in standalone mode.
// If the bean is not present, the publisher will not be used.
private final Optional<ScanStatusPublisher> scanStatusPublisherOpt;
private final EnvironmentUtil environmentUtil;

@Autowired
public ScanManager(MessagingServiceDelegateServiceImpl messagingServiceDelegateService,
ScanService scanService,
EventPortalProperties eventPortalProperties,
Optional<ScanStatusPublisher> scanStatusPublisher) {
Optional<ScanStatusPublisher> scanStatusPublisher,
EnvironmentUtil environmentUtil) {
this.messagingServiceDelegateService = messagingServiceDelegateService;
this.scanService = scanService;
this.scanStatusPublisherOpt = scanStatusPublisher;
runtimeAgentId = eventPortalProperties.getRuntimeAgentId();
this.environmentUtil = environmentUtil;
}

public String scan(ScanRequestBO scanRequestBO) {
if (environmentUtil.isCustomCACertPresent()) {
log.info("Custom CA certificates present. Using combined truststore with default and custom CA certificates for scan operation.");
}
Validate.notBlank(scanRequestBO.getOrgId(), " Organization ID cannot be null or empty");
String messagingServiceId = scanRequestBO.getMessagingServiceId();
String scanId = scanRequestBO.getScanId();
Expand Down
Loading