19
19
import java .util .zip .ZipEntry ;
20
20
import java .util .zip .ZipOutputStream ;
21
21
22
+ import javax .inject .Inject ;
23
+
22
24
import org .apache .commons .io .IOUtils ;
23
25
import org .slf4j .Logger ;
24
26
import org .slf4j .LoggerFactory ;
54
56
import com .sequenceiq .cloudbreak .orchestrator .salt .poller .checker .GrainRemoveRunner ;
55
57
import com .sequenceiq .cloudbreak .orchestrator .salt .poller .checker .HighStateRunner ;
56
58
import com .sequenceiq .cloudbreak .orchestrator .salt .poller .checker .SyncGrainsRunner ;
59
+ import com .sequenceiq .cloudbreak .orchestrator .salt .service .HostDiscoveryService ;
57
60
import com .sequenceiq .cloudbreak .orchestrator .salt .states .SaltStates ;
58
61
import com .sequenceiq .cloudbreak .orchestrator .state .ExitCriteria ;
59
62
import com .sequenceiq .cloudbreak .orchestrator .state .ExitCriteriaModel ;
@@ -73,8 +76,8 @@ public class SaltOrchestrator implements HostOrchestrator {
73
76
@ Value ("${cb.smartsense.configure:false}" )
74
77
private boolean configureSmartSense ;
75
78
76
- @ Value ( "${cb.host.discovery.custom.domain:}" )
77
- private String customDomain ;
79
+ @ Inject
80
+ private HostDiscoveryService hostDiscoveryService ;
78
81
79
82
private ParallelOrchestratorComponentRunner parallelOrchestratorComponentRunner ;
80
83
private ExitCriteria exitCriteria ;
@@ -96,7 +99,7 @@ public void bootstrap(GatewayConfig gatewayConfig, Set<Node> targets, ExitCriter
96
99
Future <Boolean > saltPillarRunnerFuture = getParallelOrchestratorComponentRunner ().submit (saltPillarRunner );
97
100
saltPillarRunnerFuture .get ();
98
101
99
- SaltBootstrap saltBootstrap = new SaltBootstrap (sc , gatewayConfig , targets );
102
+ SaltBootstrap saltBootstrap = new SaltBootstrap (sc , gatewayConfig , targets , hostDiscoveryService . determineDomain () );
100
103
Callable <Boolean > saltBootstrapRunner = runner (saltBootstrap , exitCriteria , exitCriteriaModel );
101
104
Future <Boolean > saltBootstrapRunnerFuture = getParallelOrchestratorComponentRunner ().submit (saltBootstrapRunner );
102
105
saltBootstrapRunnerFuture .get ();
@@ -109,7 +112,7 @@ public void bootstrap(GatewayConfig gatewayConfig, Set<Node> targets, ExitCriter
109
112
@ Override
110
113
public void bootstrapNewNodes (GatewayConfig gatewayConfig , Set <Node > targets , ExitCriteriaModel exitCriteriaModel ) throws CloudbreakOrchestratorException {
111
114
try (SaltConnector sc = new SaltConnector (gatewayConfig , restDebug )) {
112
- SaltBootstrap saltBootstrap = new SaltBootstrap (sc , gatewayConfig , targets );
115
+ SaltBootstrap saltBootstrap = new SaltBootstrap (sc , gatewayConfig , targets , hostDiscoveryService . determineDomain () );
113
116
Callable <Boolean > saltBootstrapRunner = runner (saltBootstrap , exitCriteria , exitCriteriaModel );
114
117
Future <Boolean > saltBootstrapRunnerFuture = getParallelOrchestratorComponentRunner ().submit (saltBootstrapRunner );
115
118
saltBootstrapRunnerFuture .get ();
@@ -123,7 +126,7 @@ public void bootstrapNewNodes(GatewayConfig gatewayConfig, Set<Node> targets, Ex
123
126
public void runService (GatewayConfig gatewayConfig , Set <Node > allNodes , SaltPillarConfig pillarConfig ,
124
127
ExitCriteriaModel exitCriteriaModel ) throws CloudbreakOrchestratorException {
125
128
try (SaltConnector sc = new SaltConnector (gatewayConfig , restDebug )) {
126
- PillarSave hostSave = new PillarSave (sc , allNodes , !StringUtils .isEmpty (customDomain ));
129
+ PillarSave hostSave = new PillarSave (sc , allNodes , !StringUtils .isEmpty (hostDiscoveryService . determineDomain () ));
127
130
Callable <Boolean > saltPillarRunner = runner (hostSave , exitCriteria , exitCriteriaModel );
128
131
Future <Boolean > saltPillarRunnerFuture = getParallelOrchestratorComponentRunner ().submit (saltPillarRunner );
129
132
saltPillarRunnerFuture .get ();
@@ -138,11 +141,7 @@ public void runService(GatewayConfig gatewayConfig, Set<Node> allNodes, SaltPill
138
141
Set <String > server = Sets .newHashSet (gatewayConfig .getPrivateAddress ());
139
142
Set <String > all = allNodes .stream ().map (Node ::getPrivateIp ).collect (Collectors .toSet ());
140
143
141
- LOGGER .info ("Pillar saved, starting to set up discovery..." );
142
- //run discovery only
143
- runNewService (sc , new HighStateRunner (all , allNodes ), exitCriteriaModel );
144
-
145
- LOGGER .info ("Pillar saved, discovery has been set up with highstate" );
144
+ LOGGER .info ("Pillar saved, setting up grains..." );
146
145
147
146
// ambari server
148
147
runSaltCommand (sc , new GrainAddRunner (server , allNodes , "ambari_server" ), exitCriteriaModel );
0 commit comments