Skip to content

Commit

Permalink
new api opts
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Oct 7, 2017
1 parent 98c19e2 commit ab0f44f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 12 additions & 3 deletions commands/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ func RemoveCommand() *cli.Command {
Name: "remove",
Usage: "remove containers",
Action: run,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "force",
Usage: "ignore or not before stop hook if it was setted and force check",
Aliases: []string{"f"},
Value: false,
},
},
}
}

Expand All @@ -23,13 +31,14 @@ func remove(c *cli.Context, conn *grpc.ClientConn) {
log.Fatal("[Remove] not specify containers")
}
client := pb.NewCoreRPCClient(conn)
ids := &pb.ContainerIDs{Ids: []*pb.ContainerID{}}
ids := []string{}
for _, id := range c.Args().Slice() {
log.Debugf("[Remove] remove %s", id)
ids.Ids = append(ids.Ids, &pb.ContainerID{Id: id})
ids = append(ids, id)
}
opts := &pb.RemoveContainerOptions{Ids: ids, Force: c.Bool("force")}

resp, err := client.RemoveContainer(context.Background(), ids)
resp, err := client.RemoveContainer(context.Background(), opts)
if err != nil {
log.Fatalf("[Remove] send request failed %v", err)
}
Expand Down
10 changes: 4 additions & 6 deletions specs.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ entrypoints:
healthcheck:
ports:
- "80/tcp"
privileged: "1"
privileged: true
hook:
after_start:
- "ls -al /"
- "env"
before_stop:
- "ls -al /tmp"
- "pwd"
force: false
before_stop:
- "abcd"
force: true
volumes:
- "/tmp:/tmp/host"

0 comments on commit ab0f44f

Please sign in to comment.