Return current operation info (#3822)

This commit is contained in:
Jamie Kinkead 2020-01-29 16:04:09 -08:00 committed by GitHub
parent 1f1bb7598c
commit 9c0e9021d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -1,6 +1,11 @@
CHANGELOG
=========
## HEAD (unreleased)
- Add information about an in-flight operation to the stack command output, if applicable.
[#3822](https://github.com/pulumi/pulumi/pull/3822)
=======
## 1.9.1 (2020-01-27)
- Fix a stack reference regression in the Python SDK.
[#3798](https://github.com/pulumi/pulumi/pull/3798)

View file

@ -18,6 +18,7 @@ import (
"encoding/json"
"fmt"
"sort"
"time"
humanize "github.com/dustin/go-humanize"
"github.com/spf13/cobra"
@ -34,6 +35,7 @@ func newStackCmd() *cobra.Command {
var showURNs bool
var showSecrets bool
var stackName string
var startTime string
cmd := &cobra.Command{
Use: "stack",
@ -69,13 +71,20 @@ func newStackCmd() *cobra.Command {
if isCloud {
if cs, ok := s.(httpstate.Stack); ok {
fmt.Printf(" Owner: %s\n", cs.OrgName())
// If there is an in-flight operation, provide info.
if currentOp := cs.CurrentOperation(); currentOp != nil {
fmt.Printf(" Update in progress:\n")
startTime = humanize.Time(time.Unix(currentOp.Started, 0))
fmt.Printf(" Started: %v\n", startTime)
fmt.Printf(" Requested By: %s\n", currentOp.Author)
}
}
}
if snap != nil {
if t := snap.Manifest.Time; t.IsZero() {
if t := snap.Manifest.Time; t.IsZero() && startTime == "" {
fmt.Printf(" Last update time unknown\n")
} else {
} else if startTime == "" {
fmt.Printf(" Last updated: %s (%v)\n", humanize.Time(t), t)
}
var cliver string