Skip to content

Commit 29ecc1a

Browse files
committed
Changing skydns events error handling and defaults
1 parent 69798a0 commit 29ecc1a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

netmaster/master/netmaster.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func SetClusterMode(cm string) error {
5454
}
5555

5656
masterRTCfg.clusterMode = cm
57-
SetDNSEnabled(false)
5857
return nil
5958
}
6059

@@ -305,17 +304,15 @@ func stopAndRemoveServiceContainer(tenantName string) error {
305304

306305
// DeleteTenantID deletes a tenant from the state store, by ID.
307306
func DeleteTenantID(stateDriver core.StateDriver, tenantID string) error {
308-
var err error
309-
310307
if IsDNSEnabled() {
311-
err = stopAndRemoveServiceContainer(tenantID)
308+
err := stopAndRemoveServiceContainer(tenantID)
312309
if err != nil {
313310
log.Errorf("Error in stopping service container for tenant: %+v", tenantID)
314311
return err
315312
}
316313
}
317314

318-
return err
315+
return nil
319316
}
320317

321318
// DeleteTenant deletes a tenant from the state store based on its ConfigTenant.

netmaster/master/network.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,19 @@ func attachServiceContainer(tenantName, networkName string, stateDriver core.Sta
180180
"Continuing without DNS provider. Error: %v", err)
181181
return nil
182182
}
183+
cinfo, err = docker.InspectContainer(contName)
184+
if err != nil {
185+
log.Warnf("Error fetching container info after starting %s"+
186+
"Continuing without DNS provider. Error: %s", contName, err)
187+
return nil
188+
}
183189
}
184190
}
185191

186192
// If it's not in running state, restart the container.
187193
// This case can occur if the host is reloaded
188194
if !cinfo.State.Running {
189-
log.Debugf("Container %s not running. Restarting the conttainer", contName)
195+
log.Debugf("Container %s not running. Restarting the container", contName)
190196
err = docker.RestartContainer(contName, 0)
191197
if err != nil {
192198
log.Warnf("Error restarting service container %s. "+
@@ -197,6 +203,11 @@ func attachServiceContainer(tenantName, networkName string, stateDriver core.Sta
197203

198204
// Refetch container info after restart
199205
cinfo, err = docker.InspectContainer(contName)
206+
if err != nil {
207+
log.Warnf("Error fetching container info after restarting %s"+
208+
"Continuing without DNS provider. Error: %s", contName, err)
209+
return nil
210+
}
200211
}
201212

202213
log.Debugf("Container info: %+v\n Hostconfig: %+v", cinfo, cinfo.HostConfig)
@@ -207,7 +218,7 @@ func attachServiceContainer(tenantName, networkName string, stateDriver core.Sta
207218
err = docker.ConnectNetwork(dnetName, contName)
208219
if err != nil {
209220
log.Warnf("Could not attach container(%s) to network %s. "+
210-
"Continuing with DNS provider. Error: %s",
221+
"Continuing without DNS provider. Error: %s",
211222
contName, dnetName, err)
212223
return nil
213224
}

0 commit comments

Comments
 (0)