Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 474cb1f

Browse files
authored
Merge pull request #206 from carmark/service_fip_validate
validate service attach-fip sub-command
2 parents af93a21 + d871e5d commit 474cb1f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

api/client/service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,15 @@ func (cli *DockerCli) CmdServiceAttach_fip(args ...string) error {
342342
cmd := Cli.Subcmd("service attach-fip", []string{"SERVICE"}, "Attach a fip to the service", true)
343343
flFip := cmd.String([]string{"-fip"}, "", "Attach a fip to the service")
344344

345-
cmd.Require(flag.Min, 1)
345+
cmd.Require(flag.Exact, 1)
346346
cmd.ParseFlags(args, true)
347347

348348
if err := cmd.Parse(args); err != nil {
349349
return nil
350350
}
351+
if *flFip == "" {
352+
return fmt.Errorf("Error: please provide the attached FIP via --fip")
353+
}
351354

352355
ctx := context.Background()
353356

0 commit comments

Comments
 (0)