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

Remove IP adress if machine didn't exist #64

Merged
merged 2 commits into from
Apr 9, 2017

Conversation

ctrlok
Copy link
Contributor

@ctrlok ctrlok commented Apr 9, 2017

Hi, while I try to fix #63 I found some bug: if docker-machine fail create instance it still create ip address. And that address not deleted with docker-machine rm.

@@ -360,6 +357,9 @@ func (d *Driver) Remove() (err error) {
if !d.IPPersistant {
err = cl.DeleteIP(d.IPID)
}
if errRemove != nil {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

err = errRemove before returning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

@QuentinPerez QuentinPerez merged commit 5599f14 into scaleway:master Apr 9, 2017
@ctrlok
Copy link
Contributor Author

ctrlok commented Apr 9, 2017

Thanks for merging.
BTW, maybe it will be better to use mcnutils.MultiError like in original plugins? Example

@ctrlok
Copy link
Contributor Author

ctrlok commented Apr 9, 2017

@QuentinPerez actually, I have some problems with this changes.
_, err = cl.GetServer(d.ServerID) will return no error if d.ServerID is an empty string.

dump

(bench-3) (*api.ScalewayServer)(0xc4200e9340)({
(bench-3)  Arch: (string) "",
(bench-3)  Identifier: (string) "",
(bench-3)  Name: (string) "",
(bench-3)  CreationDate: (string) "",
(bench-3)  ModificationDate: (string) "",
(bench-3)  Image: (api.ScalewayImage) {
(bench-3)   Identifier: (string) "",
(bench-3)   Name: (string) "",
(bench-3)   CreationDate: (string) "",
(bench-3)   ModificationDate: (string) "",
(bench-3)   RootVolume: (api.ScalewayVolume) {
(bench-3)    Identifier: (string) "",
(bench-3)    Size: (interface {}) <nil>,
(bench-3)    CreationDate: (string) "",
(bench-3)    ModificationDate: (string) "",
(bench-3)    Organization: (string) "",
(bench-3)    Name: (string) "",
(bench-3)    Server: (*struct { Identifier string "json:\"id,omitempty\""; Name string "json:\"name,omitempty\"" })(<nil>),
(bench-3)    VolumeType: (string) "",
(bench-3)    ExportURI: (string) ""
(bench-3)   },
(bench-3)   Public: (bool) false,
(bench-3)   DefaultBootscript: (*api.ScalewayBootscript)(<nil>),
(bench-3)   Organization: (string) "",
(bench-3)   Arch: (string) ""
(bench-3)  },
(bench-3)  DynamicIPRequired: (*bool)(<nil>),
(bench-3)  PublicAddress: (api.ScalewayIPAddress) {
(bench-3)   Identifier: (string) "",
(bench-3)   IP: (string) "",
(bench-3)   Dynamic: (*bool)(<nil>)
(bench-3)  },
(bench-3)  State: (string) "",
(bench-3)  StateDetail: (string) "",
(bench-3)  PrivateIP: (string) "",
(bench-3)  Bootscript: (*api.ScalewayBootscript)(<nil>),
(bench-3)  Hostname: (string) "",
(bench-3)  Tags: ([]string) <nil>,
(bench-3)  Volumes: (map[string]api.ScalewayVolume) <nil>,
(bench-3)  SecurityGroup: (api.ScalewaySecurityGroup) {
(bench-3)   Identifier: (string) "",
(bench-3)   Name: (string) ""
(bench-3)  },
(bench-3)  Organization: (string) "",
(bench-3)  CommercialType: (string) "",
(bench-3)  Location: (struct { Platform string "json:\"platform_id,omitempty\""; Chassis string "json:\"chassis_id,omitempty\""; Cluster string "json:\"cluster_id,omitempty\""; Hypervisor string "json:\"hypervisor_id,omitempty\""; Blade string "json:\"blade_id,omitempty\""; Node string "json:\"node_id,omitempty\""; ZoneID string "json:\"zone_id,omitempty\"" }) {
(bench-3)   Platform: (string) "",
(bench-3)   Chassis: (string) "",
(bench-3)   Cluster: (string) "",
(bench-3)   Hypervisor: (string) "",
(bench-3)   Blade: (string) "",
(bench-3)   Node: (string) "",
(bench-3)   ZoneID: (string) ""
(bench-3)  },
(bench-3)  IPV6: (*api.ScalewayIPV6Definition)(<nil>),
(bench-3)  EnableIPV6: (bool) false,
(bench-3)  DNSPublic: (string) (len=23) ".pub.cloud.scaleway.com",
(bench-3)  DNSPrivate: (string) (len=24) ".priv.cloud.scaleway.com"
(bench-3) })

I think it is becouse s.GetResponsePaginate will return no error, but list of servers. I will made PR to cli about this.

@ctrlok
Copy link
Contributor Author

ctrlok commented Apr 10, 2017

@QuentinPerez thanks!
please, update vendored cli package to fix the issue.

@QuentinPerez
Copy link
Contributor

@ctrlok done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problem with creating new docker-machine
2 participants