Skip to content

[Bug]: step context list should print an error to stderr and exit 1 if there are no contexts present #879

@jdoss

Description

@jdoss

Steps to Reproduce

I am looking for a way to tell if STEPPATH is using contexts or not.

$ export STEPPATH=/tmp/tmpsteppath
$ step ca bootstrap --ca-url https://my.cool.ca.smallstep.com --fingerprint myfingerprint 
$ step context list
$ echo $?
0

If STEPPATH is not using a context step context list should output that there are no contexts present to stderr and exit 1

Your Environment

Fedora Linux 37

$ step version
Smallstep CLI/0.23.4 (linux/amd64)

Expected Behavior

$ export STEPPATH=/tmp/tmpsteppath
$ step ca bootstrap --ca-url https://my.cool.ca.smallstep.com --fingerprint myfingerprint 
$ step context list
Error: There are no contexts to list
$ echo $?
1

Actual Behavior

$ export STEPPATH=/tmp/tmpsteppath
$ step ca bootstrap --ca-url https://my.cool.ca.smallstep.com --fingerprint myfingerprint 
$ step context list
$ echo $?
0

Additional Context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageWaiting for discussion / prioritization by team

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions