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

View File

@ -52,9 +52,7 @@ public class ContainerProfileBuilder {
node.newProfile().infrastructure(cfg.infrastructure());
node.setId(context.id());
addSiteTo(node);
String ip = "not resolved";
try {
ip = InetAddress.getLocalHost().getHostAddress();
@ -72,8 +70,8 @@ public class ContainerProfileBuilder {
node.profile().description().newArchitecture().platformType(System.getProperty("os.arch")).smpSize(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();
@ -88,7 +86,7 @@ public class ContainerProfileBuilder {
addVariablesTo(node);
update(node,false);
update(node);
node.profile().description().type(GHNType.Static);
// String type = (String) context.getProperty(GHNContext.GHN_TYPE, false);
@ -201,21 +199,7 @@ public class ContainerProfileBuilder {
return free;
}
public void update(HostingNode node,boolean onLoad) {
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);
}
public void update(HostingNode node) {
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) {