Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
Rik Nijessen authored on 2015/02/24 00:15:56... | ... |
@@ -712,7 +712,7 @@ func (b *Builder) clearTmp() { |
712 | 712 |
fmt.Fprint(b.OutStream, err.Error()) |
713 | 713 |
} |
714 | 714 |
|
715 |
- if err := b.Daemon.Destroy(tmp); err != nil { |
|
715 |
+ if err := b.Daemon.Rm(tmp); err != nil { |
|
716 | 716 |
fmt.Fprintf(b.OutStream, "Error removing intermediate container %s: %s\n", utils.TruncateID(c), err.Error()) |
717 | 717 |
return |
718 | 718 |
} |
... | ... |
@@ -61,7 +61,7 @@ func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status { |
61 | 61 |
return job.Errorf("Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f") |
62 | 62 |
} |
63 | 63 |
} |
64 |
- if err := daemon.Destroy(container); err != nil { |
|
64 |
+ if err := daemon.Rm(container); err != nil { |
|
65 | 65 |
return job.Errorf("Cannot destroy container %s: %s", name, err) |
66 | 66 |
} |
67 | 67 |
container.LogEvent("destroy") |
... | ... |
@@ -82,8 +82,7 @@ func (daemon *Daemon) DeleteVolumes(volumeIDs map[string]struct{}) { |
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
// Destroy unregisters a container from the daemon and cleanly removes its contents from the filesystem. |
85 |
-// FIXME: rename to Rm for consistency with the CLI command |
|
86 |
-func (daemon *Daemon) Destroy(container *Container) error { |
|
85 |
+func (daemon *Daemon) Rm(container *Container) error { |
|
87 | 86 |
if container == nil { |
88 | 87 |
return fmt.Errorf("The given container is <nil>") |
89 | 88 |
} |
... | ... |
@@ -24,7 +24,7 @@ func TestRestartStdin(t *testing.T) { |
24 | 24 |
if err != nil { |
25 | 25 |
t.Fatal(err) |
26 | 26 |
} |
27 |
- defer daemon.Destroy(container) |
|
27 |
+ defer daemon.Rm(container) |
|
28 | 28 |
|
29 | 29 |
stdin := container.StdinPipe() |
30 | 30 |
stdout := container.StdoutPipe() |
... | ... |
@@ -89,7 +89,7 @@ func TestStdin(t *testing.T) { |
89 | 89 |
if err != nil { |
90 | 90 |
t.Fatal(err) |
91 | 91 |
} |
92 |
- defer daemon.Destroy(container) |
|
92 |
+ defer daemon.Rm(container) |
|
93 | 93 |
|
94 | 94 |
stdin := container.StdinPipe() |
95 | 95 |
stdout := container.StdoutPipe() |
... | ... |
@@ -129,7 +129,7 @@ func TestTty(t *testing.T) { |
129 | 129 |
if err != nil { |
130 | 130 |
t.Fatal(err) |
131 | 131 |
} |
132 |
- defer daemon.Destroy(container) |
|
132 |
+ defer daemon.Rm(container) |
|
133 | 133 |
|
134 | 134 |
stdin := container.StdinPipe() |
135 | 135 |
stdout := container.StdoutPipe() |
... | ... |
@@ -168,7 +168,7 @@ func BenchmarkRunSequential(b *testing.B) { |
168 | 168 |
if err != nil { |
169 | 169 |
b.Fatal(err) |
170 | 170 |
} |
171 |
- defer daemon.Destroy(container) |
|
171 |
+ defer daemon.Rm(container) |
|
172 | 172 |
output, err := container.Output() |
173 | 173 |
if err != nil { |
174 | 174 |
b.Fatal(err) |
... | ... |
@@ -176,7 +176,7 @@ func BenchmarkRunSequential(b *testing.B) { |
176 | 176 |
if string(output) != "foo" { |
177 | 177 |
b.Fatalf("Unexpected output: %s", output) |
178 | 178 |
} |
179 |
- if err := daemon.Destroy(container); err != nil { |
|
179 |
+ if err := daemon.Rm(container); err != nil { |
|
180 | 180 |
b.Fatal(err) |
181 | 181 |
} |
182 | 182 |
} |
... | ... |
@@ -203,7 +203,7 @@ func BenchmarkRunParallel(b *testing.B) { |
203 | 203 |
complete <- err |
204 | 204 |
return |
205 | 205 |
} |
206 |
- defer daemon.Destroy(container) |
|
206 |
+ defer daemon.Rm(container) |
|
207 | 207 |
if err := container.Start(); err != nil { |
208 | 208 |
complete <- err |
209 | 209 |
return |
... | ... |
@@ -215,7 +215,7 @@ func BenchmarkRunParallel(b *testing.B) { |
215 | 215 |
// if string(output) != "foo" { |
216 | 216 |
// complete <- fmt.Errorf("Unexecpted output: %v", string(output)) |
217 | 217 |
// } |
218 |
- if err := daemon.Destroy(container); err != nil { |
|
218 |
+ if err := daemon.Rm(container); err != nil { |
|
219 | 219 |
complete <- err |
220 | 220 |
return |
221 | 221 |
} |
... | ... |
@@ -62,7 +62,7 @@ func cleanup(eng *engine.Engine, t *testing.T) error { |
62 | 62 |
daemon := mkDaemonFromEngine(eng, t) |
63 | 63 |
for _, container := range daemon.List() { |
64 | 64 |
container.Kill() |
65 |
- daemon.Destroy(container) |
|
65 |
+ daemon.Rm(container) |
|
66 | 66 |
} |
67 | 67 |
job := eng.Job("images") |
68 | 68 |
images, err := job.Stdout.AddTable() |
... | ... |
@@ -266,7 +266,7 @@ func TestDaemonCreate(t *testing.T) { |
266 | 266 |
} |
267 | 267 |
|
268 | 268 |
defer func() { |
269 |
- if err := daemon.Destroy(container); err != nil { |
|
269 |
+ if err := daemon.Rm(container); err != nil { |
|
270 | 270 |
t.Error(err) |
271 | 271 |
} |
272 | 272 |
}() |
... | ... |
@@ -368,7 +368,7 @@ func TestDestroy(t *testing.T) { |
368 | 368 |
t.Fatal(err) |
369 | 369 |
} |
370 | 370 |
// Destroy |
371 |
- if err := daemon.Destroy(container); err != nil { |
|
371 |
+ if err := daemon.Rm(container); err != nil { |
|
372 | 372 |
t.Error(err) |
373 | 373 |
} |
374 | 374 |
|
... | ... |
@@ -388,7 +388,7 @@ func TestDestroy(t *testing.T) { |
388 | 388 |
} |
389 | 389 |
|
390 | 390 |
// Test double destroy |
391 |
- if err := daemon.Destroy(container); err == nil { |
|
391 |
+ if err := daemon.Rm(container); err == nil { |
|
392 | 392 |
// It should have failed |
393 | 393 |
t.Errorf("Double destroy did not fail") |
394 | 394 |
} |
... | ... |
@@ -399,13 +399,13 @@ func TestGet(t *testing.T) { |
399 | 399 |
defer nuke(daemon) |
400 | 400 |
|
401 | 401 |
container1, _, _ := mkContainer(daemon, []string{"_", "ls", "-al"}, t) |
402 |
- defer daemon.Destroy(container1) |
|
402 |
+ defer daemon.Rm(container1) |
|
403 | 403 |
|
404 | 404 |
container2, _, _ := mkContainer(daemon, []string{"_", "ls", "-al"}, t) |
405 |
- defer daemon.Destroy(container2) |
|
405 |
+ defer daemon.Rm(container2) |
|
406 | 406 |
|
407 | 407 |
container3, _, _ := mkContainer(daemon, []string{"_", "ls", "-al"}, t) |
408 |
- defer daemon.Destroy(container3) |
|
408 |
+ defer daemon.Rm(container3) |
|
409 | 409 |
|
410 | 410 |
if c, _ := daemon.Get(container1.ID); c != container1 { |
411 | 411 |
t.Errorf("Get(test1) returned %v while expecting %v", c, container1) |
... | ... |
@@ -594,11 +594,11 @@ func TestRestore(t *testing.T) { |
594 | 594 |
defer daemon1.Nuke() |
595 | 595 |
// Create a container with one instance of docker |
596 | 596 |
container1, _, _ := mkContainer(daemon1, []string{"_", "ls", "-al"}, t) |
597 |
- defer daemon1.Destroy(container1) |
|
597 |
+ defer daemon1.Rm(container1) |
|
598 | 598 |
|
599 | 599 |
// Create a second container meant to be killed |
600 | 600 |
container2, _, _ := mkContainer(daemon1, []string{"-i", "_", "/bin/cat"}, t) |
601 |
- defer daemon1.Destroy(container2) |
|
601 |
+ defer daemon1.Rm(container2) |
|
602 | 602 |
|
603 | 603 |
// Start the container non blocking |
604 | 604 |
if err := container2.Start(); err != nil { |
... | ... |
@@ -886,7 +886,7 @@ func TestDestroyWithInitLayer(t *testing.T) { |
886 | 886 |
t.Fatal(err) |
887 | 887 |
} |
888 | 888 |
// Destroy |
889 |
- if err := daemon.Destroy(container); err != nil { |
|
889 |
+ if err := daemon.Rm(container); err != nil { |
|
890 | 890 |
t.Fatal(err) |
891 | 891 |
} |
892 | 892 |
|
... | ... |
@@ -46,7 +46,7 @@ func TestMergeConfigOnCommit(t *testing.T) { |
46 | 46 |
defer runtime.Nuke() |
47 | 47 |
|
48 | 48 |
container1, _, _ := mkContainer(runtime, []string{"-e", "FOO=bar", unitTestImageID, "echo test > /tmp/foo"}, t) |
49 |
- defer runtime.Destroy(container1) |
|
49 |
+ defer runtime.Rm(container1) |
|
50 | 50 |
|
51 | 51 |
config, _, _, err := parseRun([]string{container1.ID, "cat /tmp/foo"}) |
52 | 52 |
if err != nil { |
... | ... |
@@ -64,7 +64,7 @@ func TestMergeConfigOnCommit(t *testing.T) { |
64 | 64 |
} |
65 | 65 |
|
66 | 66 |
container2, _, _ := mkContainer(runtime, []string{engine.Tail(outputBuffer, 1)}, t) |
67 |
- defer runtime.Destroy(container2) |
|
67 |
+ defer runtime.Rm(container2) |
|
68 | 68 |
|
69 | 69 |
job = eng.Job("container_inspect", container1.Name) |
70 | 70 |
baseContainer, _ := job.Stdout.AddEnv() |
... | ... |
@@ -293,7 +293,7 @@ func runContainer(eng *engine.Engine, r *daemon.Daemon, args []string, t *testin |
293 | 293 |
if err != nil { |
294 | 294 |
return "", err |
295 | 295 |
} |
296 |
- defer r.Destroy(container) |
|
296 |
+ defer r.Rm(container) |
|
297 | 297 |
stdout := container.StdoutPipe() |
298 | 298 |
defer stdout.Close() |
299 | 299 |
|