blob: 4267633709d1feca21014d1e6ab7ff36391c55dd [file] [log] [blame]
package volumes
import (
"gerrit.mcp.mirantis.net/debian/gophercloud.git"
)
// WaitForStatus will continually poll the resource, checking for a particular
// status. It will do this for the amount of seconds defined.
func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error {
return gophercloud.WaitFor(secs, func() (bool, error) {
current, err := Get(c, id).Extract()
if err != nil {
return false, err
}
if current.Status == status {
return true, nil
}
return false, nil
})
}