mirror of https://github.com/docker/docs.git
check reservation before accessing instance
Docker-DCO-1.1-Signed-off-by: Aaron Feng aaron.feng@gmail.com (github: aaronfeng)
This commit is contained in:
parent
b1fb5ace1b
commit
e91e665cc8
|
@ -172,6 +172,9 @@ func (c *ec2Client) findInstance() (instance *ec2.Instance, err error) {
|
||||||
if resp, err := c.ec2Conn.Instances([]string{}, filter); err != nil {
|
if resp, err := c.ec2Conn.Instances([]string{}, filter); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
|
if resp.Reservations == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
return &resp.Reservations[0].Instances[0], nil
|
return &resp.Reservations[0].Instances[0], nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue