domain calculated using the host

This commit is contained in:
Lucio Lelii 2022-07-18 11:27:20 +02:00
parent 97d5fc1c05
commit cfdcc76a1e
2 changed files with 9 additions and 31 deletions

View File

@ -47,7 +47,7 @@ public class LegacyISPublisher implements Publisher{
hostingNode = cpb.create(); hostingNode = cpb.create();
else { else {
hostingNode = (HostingNode) resourcesCache.get(id); hostingNode = (HostingNode) resourcesCache.get(id);
cpb.update(hostingNode, false); cpb.update(hostingNode);
} }
for (String context: contexts) for (String context: contexts)
@ -126,7 +126,7 @@ public class LegacyISPublisher implements Publisher{
hostingNode = cpb.create(); hostingNode = cpb.create();
else { else {
hostingNode = (HostingNode) resourcesCache.get(id); hostingNode = (HostingNode) resourcesCache.get(id);
cpb.update(hostingNode, false); cpb.update(hostingNode);
} }
for (String context: contexts) for (String context: contexts)
@ -260,7 +260,7 @@ public class LegacyISPublisher implements Publisher{
String id = container.id(); String id = container.id();
hostingNode = (HostingNode) resourcesCache.get(id); hostingNode = (HostingNode) resourcesCache.get(id);
cpb.update(hostingNode, false); cpb.update(hostingNode);
resourcesCache.put(id, hostingNode); resourcesCache.put(id, hostingNode);
} }

View File

@ -53,8 +53,6 @@ public class ContainerProfileBuilder {
node.setId(context.id()); node.setId(context.id());
addSiteTo(node);
String ip = "not resolved"; String ip = "not resolved";
try { try {
ip = InetAddress.getLocalHost().getHostAddress(); ip = InetAddress.getLocalHost().getHostAddress();
@ -73,7 +71,7 @@ public class ContainerProfileBuilder {
node.profile().description().newArchitecture().platformType(System.getProperty("os.arch")).smpSize(0) node.profile().description().newArchitecture().platformType(System.getProperty("os.arch")).smpSize(0)
.smtSize(0); .smtSize(0);
node.profile().newSite().domain(cfg.site().getCountry()).country(cfg.site().getCountry()).location(cfg.site().getLocation()).latitude("1").longitude("1"); node.profile().newSite().domain(domainIn(cfg.hostname())).country(cfg.site().getCountry()).location(cfg.site().getLocation()).latitude("1").longitude("1");
ArrayList<HashMap<String, String>> info = cpuInfo(); ArrayList<HashMap<String, String>> info = cpuInfo();
@ -88,7 +86,7 @@ public class ContainerProfileBuilder {
addVariablesTo(node); addVariablesTo(node);
update(node,false); update(node);
node.profile().description().type(GHNType.Static); node.profile().description().type(GHNType.Static);
// String type = (String) context.getProperty(GHNContext.GHN_TYPE, false); // String type = (String) context.getProperty(GHNContext.GHN_TYPE, false);
@ -201,21 +199,7 @@ public class ContainerProfileBuilder {
return free; return free;
} }
public void update(HostingNode node,boolean onLoad) { public void update(HostingNode node) {
ContainerConfiguration cfg = context.configuration();
if (onLoad) {
log.info("updating ghn profile");
node.profile().description().activationTime(Calendar.getInstance()).name(cfg.hostname() + ":" + cfg.port());
addVariablesTo(node);
addSiteTo(node);
}
node.profile().description().status(context.lifecycle().state().remoteForm()); node.profile().description().status(context.lifecycle().state().remoteForm());
@ -239,13 +223,7 @@ public class ContainerProfileBuilder {
} }
private void addSiteTo(HostingNode node) {
ContainerConfiguration cfg = context.configuration();
node.profile().newSite().country(cfg.site().getCountry()).location(cfg.site().getLocation())
.latitude("unknown").longitude("unknown").domain(domainIn(cfg.hostname()));
}
private void addVariablesTo(HostingNode node) { private void addVariablesTo(HostingNode node) {