Merge pull request #4918 from ColinHebert/docker_network_error
provider/docker: Catch potential custom network errors in docker
This commit is contained in:
commit
e490b44daa
|
@ -162,8 +162,11 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
|
|||
if v, ok := d.GetOk("networks"); ok {
|
||||
connectionOpts := dc.NetworkConnectionOptions{Container: retContainer.ID}
|
||||
|
||||
for _, network := range v.(*schema.Set).List() {
|
||||
client.ConnectNetwork(network.(string), connectionOpts)
|
||||
for _, rawNetwork := range v.(*schema.Set).List() {
|
||||
network := rawNetwork.(string)
|
||||
if err := client.ConnectNetwork(network, connectionOpts); err != nil {
|
||||
return fmt.Errorf("Unable to connect to network '%s': %s", network, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue