This commit is contained in:
crusader 2018-06-12 14:08:49 +09:00
parent f7762f3060
commit cd6b5d74fb
2 changed files with 22 additions and 4 deletions

View File

@ -50,7 +50,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.45-SNAPSHOT</version>
<version>1.0.47-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -12,6 +12,8 @@ import com.loafle.overflow.model.apikey.ApiKey;
import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.domain.DomainMember;
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.meta.MetaNoAuthProbeStatus;
import com.loafle.overflow.model.meta.MetaProbeStatus;
@ -95,14 +97,30 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
@Transactional
public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID, String zoneCIDR) throws OverflowException {
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 {
infraHost = this.objectMapper.readValue(noAuthProbe.getInfraHostMeta(), InfraHost.class);
oriInfraHost = this.objectMapper.readValue(noAuthProbe.getInfraHostMeta(), InfraHost.class);
} catch (IOException 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);
InfraHost host = this.infraService.registByNoAuthProbe(probe.getId(), infraHost);
this.newProbeHost(host, probe);
@ -132,7 +150,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
probe.setDomain(new Domain(apiKey.getDomain().getId()));
probe.setAuthorizeMember(new Member(domainMember.getMember().getId()));
probe.setTargetCount(0);
probe.setMetaProbeStatus(new MetaProbeStatus((short) 1));
probe.setMetaProbeStatus(MetaProbeStatus.Enum.INITIAL.to());
String name = infraHost.getInfraHostOS().getName();
name += " probe";