Skip to content

Commit bfda45e

Browse files
committed
handle no given zone id
1 parent 876bdbd commit bfda45e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lwdriver/core.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func (self *Driver) GetCreateFlags() []mcnflag.Flag {
9090
EnvVar: "LW_CONFIG_ID",
9191
Name: "lw-config-id",
9292
Usage: "config-id to deploy the node as",
93+
Value: -1,
9394
},
9495

9596
mcnflag.IntFlag{
@@ -123,17 +124,21 @@ func (self *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error {
123124
self.LwApiDomain = opts.String("lw-api-domain")
124125

125126
self.LwComputeConfigId = opts.Int("lw-config-id")
126-
if self.LwComputeConfigId == 0 {
127-
// TODO private parent child support
128-
return errors.New("must give a lw-config-id")
129-
}
130127
self.LwComputeZoneId = opts.Int("lw-zone-id")
131128
self.LwComputeNodeHostname = opts.String("lw-node-hostname")
132129
self.LwComputeNodeRootPassword = opts.String("lw-node-root-password")
133130
self.LwComputeTemplate = opts.String("lw-template")
134131

135132
self.DockerPort = opts.Int("lw-docker-port")
136133

134+
if self.LwComputeConfigId == -1 {
135+
return errors.New("must give a lw-config-id")
136+
}
137+
138+
if self.LwComputeZoneId == -1 {
139+
return errors.New("must give a lw-zone-id")
140+
}
141+
137142
if self.DockerPort <= 0 {
138143
return errors.New("docker port must be greater than zero")
139144
}

0 commit comments

Comments
 (0)