ing
This commit is contained in:
parent
f7762f3060
commit
cd6b5d74fb
2
pom.xml
2
pom.xml
|
@ -50,7 +50,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.loafle.overflow</groupId>
|
<groupId>com.loafle.overflow</groupId>
|
||||||
<artifactId>commons-java</artifactId>
|
<artifactId>commons-java</artifactId>
|
||||||
<version>1.0.45-SNAPSHOT</version>
|
<version>1.0.47-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -12,6 +12,8 @@ import com.loafle.overflow.model.apikey.ApiKey;
|
||||||
import com.loafle.overflow.model.domain.Domain;
|
import com.loafle.overflow.model.domain.Domain;
|
||||||
import com.loafle.overflow.model.domain.DomainMember;
|
import com.loafle.overflow.model.domain.DomainMember;
|
||||||
import com.loafle.overflow.model.infra.InfraHost;
|
import com.loafle.overflow.model.infra.InfraHost;
|
||||||
|
import com.loafle.overflow.model.infra.InfraHostIP;
|
||||||
|
import com.loafle.overflow.model.infra.InfraZone;
|
||||||
import com.loafle.overflow.model.member.Member;
|
import com.loafle.overflow.model.member.Member;
|
||||||
import com.loafle.overflow.model.meta.MetaNoAuthProbeStatus;
|
import com.loafle.overflow.model.meta.MetaNoAuthProbeStatus;
|
||||||
import com.loafle.overflow.model.meta.MetaProbeStatus;
|
import com.loafle.overflow.model.meta.MetaProbeStatus;
|
||||||
|
@ -95,14 +97,30 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID, String zoneCIDR) throws OverflowException {
|
public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID, String zoneCIDR) throws OverflowException {
|
||||||
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findById(noAuthProbeID).get();
|
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findById(noAuthProbeID).get();
|
||||||
|
if (null == noAuthProbe) {
|
||||||
|
throw new OverflowException(String.format("ID(%s) of NoAuthProbe is not exist", noAuthProbeID));
|
||||||
|
}
|
||||||
|
|
||||||
InfraHost infraHost = null;
|
InfraHost oriInfraHost = null;
|
||||||
try {
|
try {
|
||||||
infraHost = this.objectMapper.readValue(noAuthProbe.getInfraHostMeta(), InfraHost.class);
|
oriInfraHost = this.objectMapper.readValue(noAuthProbe.getInfraHostMeta(), InfraHost.class);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new OverflowException("json error", e);
|
throw new OverflowException("json error", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null == oriInfraHost.getInfraHostIPs()) {
|
||||||
|
throw new OverflowException("IP of Probe InfraHost is not valild");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (InfraHostIP infraHostIP : oriInfraHost.getInfraHostIPs()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InfraZone infraZone = new InfraZone();
|
||||||
|
InfraHost infraHost = new InfraHost();
|
||||||
|
|
||||||
|
|
||||||
Probe probe = this.newProbe(noAuthProbe, infraHost);
|
Probe probe = this.newProbe(noAuthProbe, infraHost);
|
||||||
InfraHost host = this.infraService.registByNoAuthProbe(probe.getId(), infraHost);
|
InfraHost host = this.infraService.registByNoAuthProbe(probe.getId(), infraHost);
|
||||||
this.newProbeHost(host, probe);
|
this.newProbeHost(host, probe);
|
||||||
|
@ -132,7 +150,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
|
||||||
probe.setDomain(new Domain(apiKey.getDomain().getId()));
|
probe.setDomain(new Domain(apiKey.getDomain().getId()));
|
||||||
probe.setAuthorizeMember(new Member(domainMember.getMember().getId()));
|
probe.setAuthorizeMember(new Member(domainMember.getMember().getId()));
|
||||||
probe.setTargetCount(0);
|
probe.setTargetCount(0);
|
||||||
probe.setMetaProbeStatus(new MetaProbeStatus((short) 1));
|
probe.setMetaProbeStatus(MetaProbeStatus.Enum.INITIAL.to());
|
||||||
|
|
||||||
String name = infraHost.getInfraHostOS().getName();
|
String name = infraHost.getInfraHostOS().getName();
|
||||||
name += " probe";
|
name += " probe";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user