Created
December 28, 2020 18:32
-
-
Save EvanBoyle/f5e7c77f94851238d93efbefba1debfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func reset(ctx context.Context, s auto.Stack){ | |
args.Output.Write([]byte("canceling any active updates...\n")) | |
// we ignore the error on a cancel as it errors if there is no update running... | |
_ = s.Cancel(ctx) | |
args.Output.Write([]byte("removing any pending operations...\n")) | |
exp, err := s.Workspace().ExportStack(ctx, s.Name()) | |
if err != nil { | |
return errors.Wrap(err, "failed to reset stack, could not export stack") | |
} | |
err = s.Workspace().ImportStack(ctx, s.Name(), exp) | |
if err != nil { | |
return errors.Wrap(err, "failed to reset stack, could not import stack") | |
} | |
args.Output.Write([]byte("refreshing stack...\n")) | |
_, err = s.Refresh(ctx, optrefresh.ProgressStreams(args.Output)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment