1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-31 14:36:32 +00:00

Add host to wait for container check

This commit is contained in:
David Lewis
2018-03-30 10:28:03 -07:00
parent 192182c5d6
commit c2ad3d5c4d
3 changed files with 5 additions and 5 deletions

View File

@@ -268,19 +268,19 @@ func StopRenameContainer(ctx context.Context, dClient *client.Client, hostname s
if err := StopContainer(ctx, dClient, hostname, oldContainerName); err != nil {
return err
}
if err := WaitForContainer(ctx, dClient, oldContainerName); err != nil {
if err := WaitForContainer(ctx, dClient, hostname, oldContainerName); err != nil {
return nil
}
err := RenameContainer(ctx, dClient, hostname, oldContainerName, newContainerName)
return err
}
func WaitForContainer(ctx context.Context, dClient *client.Client, containerName string) error {
func WaitForContainer(ctx context.Context, dClient *client.Client, hostname string, containerName string) error {
statusCh, errCh := dClient.ContainerWait(ctx, containerName, container.WaitConditionNotRunning)
select {
case err := <-errCh:
if err != nil {
return fmt.Errorf("Error wating for container [%s]: %v", containerName, err)
return fmt.Errorf("Error waiting for container [%s] on host [%s]: %v", containerName, hostname, err)
}
case <-statusCh:
}