Skip to content

Commit

Permalink
fix minor error on docker sync
Browse files Browse the repository at this point in the history
  • Loading branch information
guumaster committed Apr 13, 2020
1 parent cae3517 commit 79b110f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/sync_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ Reads from Docker the list of containers and add names and IPs to a profile in y
return h.Flush()
},
PostRunE: func(cmd *cobra.Command, args []string) error {
return postActionCmd(cmd, args, removeCmd, false)
return postActionCmd(cmd, args, removeCmd, true)
},
}
3 changes: 3 additions & 0 deletions pkg/host/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ func (f *File) MergeProfiles(content *Content) {
continue
}
baseP := f.data.Profiles[newName]
if baseP.Routes == nil {
baseP.Routes = map[string]*Route{}
}
for _, r := range newP.Routes {
ip := r.IP.String()
if _, ok := baseP.Routes[ip]; ok {
Expand Down
5 changes: 3 additions & 2 deletions pkg/host/profile_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ type DockerOptions struct {

func NewProfileFromDocker(ctx context.Context, opts *DockerOptions) (*Profile, error) {
cli := opts.Cli
var err error
if opts.Cli == nil {
cli, err := client.NewEnvClient()
cli, err = client.NewEnvClient()
if err != nil {
return nil, err
}
defer cli.Close()
}
defer cli.Close()

f := filters.NewArgs()
f.Add("status", "running")
Expand Down

0 comments on commit 79b110f

Please sign in to comment.