Skip to content

Commit

Permalink
Merge pull request #496 from nrb/fix-477
Browse files Browse the repository at this point in the history
Check restore Phase before downloading logs
  • Loading branch information
ncdc authored May 17, 2018
2 parents f288902 + f6761dd commit 3a746a3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/cmd/cli/restore/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"
"time"

"github.com/pkg/errors"
"github.com/spf13/cobra"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -82,6 +83,12 @@ func (l *LogsOptions) Validate(f client.Factory) error {
}
l.client = c

_, err = l.client.ArkV1().Restores(f.Namespace()).Get(l.RestoreName, metav1.GetOptions{})
return err
r, err := l.client.ArkV1().Restores(f.Namespace()).Get(l.RestoreName, metav1.GetOptions{})
if err != nil {
return err
}
if r.Status.Phase != v1.RestorePhaseCompleted {
return errors.Errorf("unable to retrieve logs because restore is not complete")
}
return nil
}

0 comments on commit 3a746a3

Please sign in to comment.