Skip to content

Commit 420e0e1

Browse files
committed
Suppress messages on needs-renewal commands
This commit suppresses the message "certificate does not need renewal" on the `step certificate needs-renewal` and `step ssh needs-renewal` unless the `--verbose` flag is passed.
1 parent c368d64 commit 420e0e1

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2626

2727
---
2828

29+
## [x.y.z] - TBD
30+
31+
### Changed
32+
33+
- Suppress output messages for `step certificate needs-renewal` and `step ssh
34+
needs-renewal` commands when certificates don't need renewal. Use the
35+
`--verbose` flag to always show messages regardless of renewal status
36+
(smallstep/cli#1548).
37+
2938
## [0.29.0] - 2025-12-02
3039

3140
### Added

command/certificate/needsRenewal.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ $ step certificate needs-renewal ./certificate.crt --bundle
6060
'''
6161
6262
Check if the leaf certificate provided by smallstep.com has passed 66 percent
63-
of its vlaidity period:
63+
of its validity period:
6464
'''
6565
$ step certificate needs-renewal https://smallstep.com
6666
'''
@@ -234,5 +234,11 @@ func isVerboseExit(needsRenewal, isVerbose bool) error {
234234
}
235235
return nil
236236
}
237-
return errs.NewExitError(errors.Errorf("certificate does not need renewal"), 1)
237+
238+
if isVerbose {
239+
return errs.NewExitError(errors.Errorf("certificate does not need renewal"), 1)
240+
}
241+
242+
// urfave/cli won't show any message
243+
return cli.NewExitError("", 1)
238244
}

command/ssh/needsRenewal.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,11 @@ func isVerboseExit(needsRenewal, isVerbose bool) error {
172172
}
173173
return nil
174174
}
175-
return errs.NewExitError(errors.Errorf("certificate does not need renewal"), 1)
175+
176+
if isVerbose {
177+
return errs.NewExitError(errors.Errorf("certificate does not need renewal"), 1)
178+
}
179+
180+
// urfave/cli won't show any message
181+
return cli.NewExitError("", 1)
176182
}

0 commit comments

Comments
 (0)