Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit ad774c7

Browse files
authored
Merge pull request #2047 from hashicorp/cli-status-time-unknown
cli/status: fix broken output when no generated time is set
2 parents 924aa3a + 535fd23 commit ad774c7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.changelog/2047.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```release-note:improvement
2+
cli/status: Display '(unknown)' when the time a status report was generated is
3+
not known
4+
```

internal/cli/status.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -947,12 +947,12 @@ func (c *StatusCommand) FormatStatusReportComplete(
947947
statusReportComplete = "? UNKNOWN"
948948
}
949949

950-
t, err := ptypes.Timestamp(statusReport.GeneratedTime)
951-
if err != nil {
952-
return statusReportComplete, "", err
950+
reportTime := "(unknown)"
951+
if statusReport.GeneratedTime.IsValid() {
952+
reportTime = humanize.Time(statusReport.GeneratedTime.AsTime())
953953
}
954954

955-
return statusReportComplete, humanize.Time(t), nil
955+
return statusReportComplete, reportTime, nil
956956
}
957957

958958
func (c *StatusCommand) getWorkspaceFromProject(pr *pb.GetProjectResponse) (string, error) {

0 commit comments

Comments
 (0)