This commit is contained in:
crusader 2018-06-12 13:02:47 +09:00
parent 1c6ce5c1e0
commit f7762f3060
3 changed files with 9 additions and 11 deletions

View File

@ -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.43-SNAPSHOT</version> <version>1.0.45-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -23,7 +23,6 @@ import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.model.meta.MetaPortType; import com.loafle.overflow.model.meta.MetaPortType;
import com.loafle.overflow.model.meta.MetaTargetHostType; import com.loafle.overflow.model.meta.MetaTargetHostType;
import com.loafle.overflow.model.meta.MetaTargetZoneType; import com.loafle.overflow.model.meta.MetaTargetZoneType;
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescription;
import com.loafle.overflow.service.central.infra.InfraService; import com.loafle.overflow.service.central.infra.InfraService;
import com.loafle.overflow.service.central.probe.ProbeService; import com.loafle.overflow.service.central.probe.ProbeService;
@ -270,7 +269,7 @@ public class CentralInfraService implements InfraService {
return infras; return infras;
} }
public InfraHost registByNoAuthProbe(Long probeID, NoAuthProbeDescription noAuthProbeDescription) public InfraHost registByNoAuthProbe(Long probeID, InfraHost infraHost)
throws OverflowException { throws OverflowException {
// NoAuthProbeDescriptionNetwork networkInfo = noAuthProbeDescription.getNetwork(); // NoAuthProbeDescriptionNetwork networkInfo = noAuthProbeDescription.getNetwork();
// InfraHostIP infraHostIP = new InfraHostIP(); // InfraHostIP infraHostIP = new InfraHostIP();

View File

@ -16,7 +16,6 @@ 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;
import com.loafle.overflow.model.noauthprobe.NoAuthProbe; import com.loafle.overflow.model.noauthprobe.NoAuthProbe;
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescription;
import com.loafle.overflow.model.probe.Probe; import com.loafle.overflow.model.probe.Probe;
import com.loafle.overflow.model.probe.ProbeHost; import com.loafle.overflow.model.probe.ProbeHost;
import com.loafle.overflow.service.central.apikey.ApiKeyService; import com.loafle.overflow.service.central.apikey.ApiKeyService;
@ -94,18 +93,18 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
@WebappAPI @WebappAPI
@Transactional @Transactional
public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID) 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();
NoAuthProbeDescription noAuthProbeDescription = null; InfraHost infraHost = null;
try { try {
noAuthProbeDescription = this.objectMapper.readValue(noAuthProbe.getDescription(), NoAuthProbeDescription.class); infraHost = 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);
} }
Probe probe = this.newProbe(noAuthProbe, noAuthProbeDescription); Probe probe = this.newProbe(noAuthProbe, infraHost);
InfraHost host = this.infraService.registByNoAuthProbe(probe.getId(), noAuthProbeDescription); InfraHost host = this.infraService.registByNoAuthProbe(probe.getId(), infraHost);
this.newProbeHost(host, probe); this.newProbeHost(host, probe);
noAuthProbe.setMetaNoAuthProbeStatus(new MetaNoAuthProbeStatus((short) 1)); noAuthProbe.setMetaNoAuthProbeStatus(new MetaNoAuthProbeStatus((short) 1));
@ -117,7 +116,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
return this.readAllByDomainID(noAuthProbe.getDomain().getId()); return this.readAllByDomainID(noAuthProbe.getDomain().getId());
} }
private Probe newProbe(NoAuthProbe noauthprobe, NoAuthProbeDescription noAuthProbeDescription) private Probe newProbe(NoAuthProbe noauthprobe, InfraHost infraHost)
throws OverflowException { throws OverflowException {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
@ -135,7 +134,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
probe.setTargetCount(0); probe.setTargetCount(0);
probe.setMetaProbeStatus(new MetaProbeStatus((short) 1)); probe.setMetaProbeStatus(new MetaProbeStatus((short) 1));
String name = noAuthProbeDescription.getInfraHost().getInfraHostOS().getName(); String name = infraHost.getInfraHostOS().getName();
name += " probe"; name += " probe";
probe.setName(name); probe.setName(name);