scaleway / docker-machine-driver-scaleway

:whale: Scaleway driver for Docker Machine
MIT License
249 stars 34 forks source link

Remove IP adress if machine didn't exist #64

Closed ctrlok closed 7 years ago

ctrlok commented 7 years ago

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.

ctrlok commented 7 years ago

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

ctrlok commented 7 years ago

@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 {}) , (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\"" })(), (bench-3) VolumeType: (string) "", (bench-3) ExportURI: (string) "" (bench-3) }, (bench-3) Public: (bool) false, (bench-3) DefaultBootscript: (*api.ScalewayBootscript)(), (bench-3) Organization: (string) "", (bench-3) Arch: (string) "" (bench-3) }, (bench-3) DynamicIPRequired: (*bool)(), (bench-3) PublicAddress: (api.ScalewayIPAddress) { (bench-3) Identifier: (string) "", (bench-3) IP: (string) "", (bench-3) Dynamic: (*bool)() (bench-3) }, (bench-3) State: (string) "", (bench-3) StateDetail: (string) "", (bench-3) PrivateIP: (string) "", (bench-3) Bootscript: (*api.ScalewayBootscript)(), (bench-3) Hostname: (string) "", (bench-3) Tags: ([]string) , (bench-3) Volumes: (map[string]api.ScalewayVolume) , (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)(), (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 commented 7 years ago

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

QuentinPerez commented 7 years ago

@ctrlok done :)