Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 1173479 - 4.13: Native Management Port/Host does not take into ac…
Browse files Browse the repository at this point in the history
…count

port offset?

Fixed AS7 resourceUpgrade code to always detect native management host/port
in case resource is running and defaults are set
  • Loading branch information
Libor Zoubek committed Jan 7, 2015
1 parent e8a902e commit 0832e0a
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,24 @@ public ResourceUpgradeReport upgrade(ResourceUpgradeContext inventoriedResource)

report.setNewPluginConfiguration(pluginConfiguration);
}
// detect if server is running and has default values
if (inventoriedResource.getNativeProcess() != null
&& "127.0.0.1".equals(serverPluginConfiguration.getNativeHost())
&& Integer.valueOf(9999).equals(serverPluginConfiguration.getNativePort())) {
try {
AS7CommandLine commandLine = new AS7CommandLine(inventoriedResource.getNativeProcess());
HostConfiguration hostConfiguration = loadHostConfiguration(serverPluginConfiguration
.getHostConfigFile());
HostPort hp = hostConfiguration.getNativeHostPort(commandLine, getMode());
serverPluginConfiguration.setNativeHost(hp.host);
serverPluginConfiguration.setNativePort(hp.port);
report.setNewPluginConfiguration(serverPluginConfiguration.getPluginConfig());
LOG.info("Detected native host/port " + hp + " for " + inventoriedResource.getResourceKey());
upgraded = true;
} catch (Exception e) {
LOG.error("Unable to detect and upgrade native management host and port", e);
}
}

if (upgraded) {
return report;
Expand Down

0 comments on commit 0832e0a

Please sign in to comment.