Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add rm flag in pouch run command #1125

Merged
merged 1 commit into from
Apr 17, 2018
Merged

feature: add rm flag in pouch run command #1125

merged 1 commit into from
Apr 17, 2018

Conversation

Ace-Tang
Copy link
Contributor

Signed-off-by: Ace-Tang [email protected]

Ⅰ. Describe what this PR did

add rm flag in pouch run command

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Apr 13, 2018

Codecov Report

Merging #1125 into master will increase coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1125      +/-   ##
==========================================
+ Coverage   15.56%   15.61%   +0.04%     
==========================================
  Files         172      172              
  Lines        9744     9752       +8     
==========================================
+ Hits         1517     1523       +6     
  Misses       8119     8119              
- Partials      108      110       +2
Impacted Files Coverage Δ
cli/container.go 0% <ø> (ø) ⬆️
cli/run.go 0% <0%> (ø) ⬆️
cli/start.go 0% <0%> (ø) ⬆️
pkg/kernel/kernel.go 72.72% <0%> (-27.28%) ⬇️
cli/cli.go 0% <0%> (ø) ⬆️

@@ -52,6 +52,8 @@ func (rc *RunCommand) addFlags() {
flagSet.BoolVarP(&rc.attach, "attach", "a", false, "Attach container's STDOUT and STDERR")
flagSet.BoolVarP(&rc.stdin, "interactive", "i", false, "Attach container's STDIN")
flagSet.BoolVarP(&rc.detach, "detach", "d", false, "Run container in background and print container ID")
flagSet.BoolVar(&rc.rm, "rm", false, "Automatically remove the container after it exits")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after it has exited?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think exits is ok.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am on the side of exits.

cli/run.go Outdated

if rc.rm {
if err := apiClient.ContainerRemove(ctx, containerName, true); err != nil {
return fmt.Errorf("failed to stop container %s: %v", containerName, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/stop/remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has updated.


if rc.rm {
if err := apiClient.ContainerRemove(ctx, containerName, true); err != nil {
return fmt.Errorf("failed to remove container %s: %v", containerName, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If error happens at this point, shall we return an exit code of non-zero?
With the change, we still return exit code of 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it a error happend here, this behaviour will get a error message, and of course, it should not be exit of 0, it will get exit code of 1 .

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I misunderstand your point.

@rudyfly rudyfly merged commit f7e7268 into AliyunContainerService:master Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants