Skip to content

Instantly share code, notes, and snippets.

@aboch
Created September 15, 2015 20:46
Show Gist options
  • Save aboch/c92645f37b3979b31c23 to your computer and use it in GitHub Desktop.
Save aboch/c92645f37b3979b31c23 to your computer and use it in GitHub Desktop.
diff --git a/controller.go b/controller.go
index 83f30e7..3cc2ba7 100644
--- a/controller.go
+++ b/controller.go
@@ -410,7 +410,7 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (S
containerID: containerID,
endpoints: epHeap{},
epPriority: map[string]int{},
- config: containerConfig{},
+ config: sandboxConfig{},
controller: c,
}
// This sandbox may be using an existing osl sandbox, sharing it with another sandbox
diff --git a/sandbox.go b/sandbox.go
index bd47394..b546eb4 100644
--- a/sandbox.go
+++ b/sandbox.go
@@ -56,7 +56,7 @@ type epHeap []*endpoint
type sandbox struct {
id string
containerID string
- config containerConfig
+ config sandboxConfig
osSbox osl.Sandbox
controller *controller
refCnt int
@@ -99,7 +99,7 @@ type resolvConfPathConfig struct {
dnsOptionsList []string
}
-type containerConfig struct {
+type sandboxConfig struct {
hostsPathConfig
resolvConfPathConfig
generic map[string]interface{}
@@ -177,7 +177,7 @@ func (sb *sandbox) Refresh(options ...SandboxOption) error {
}
// Re-apply options
- sb.config = containerConfig{}
+ sb.config = sandboxConfig{}
sb.processOptions(options...)
// Setup discovery files
@@ -279,7 +279,7 @@ func (sb *sandbox) SetKey(basePath string) error {
}
sb.Lock()
- if sb.osSbox != nil {
+ if sb.osSbox != nil && !sb.config.useDefaultSandBox {
sb.Unlock()
return types.ForbiddenErrorf("failed to set sandbox key : already assigned")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment