Skip to content

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

Open

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).

Activity

  1. added
    needs triageWaiting for discussion / prioritization by team
    on Mar 12, 2023
  2. jdoss commented on Mar 12, 2023

    @jdoss
    ContributorAuthor

    I guess one can use step context current to test if the STEPPATH is using a context but I think should we add the same behavior to step context list

    $ step context current
    no context selected
    $ echo $?
    1
    
  3. added this to the v0.24.0 milestone on Mar 15, 2023
  4. modified the milestones: v0.24.0, v0.24.1 on Apr 12, 2023
  5. modified the milestones: v0.24.4, v0.24.5 on Jul 18, 2023
  6. modified the milestones: v0.25.0, v0.25.1 on Sep 27, 2023
  7. modified the milestones: v0.25.1, v0.25.2 on Nov 29, 2023
  8. modified the milestones: v0.25.2, v0.25.3 on Feb 20, 2024
  9. removed this from the v0.26.0 milestone on Mar 29, 2024
  10. 13 remaining items

  11. modified the milestones: v0.27.6, v0.28.1 on Oct 30, 2024
  12. modified the milestones: v0.28.1, v0.28.3 on Nov 21, 2024
  13. modified the milestones: v0.28.3, v0.28.4 on Feb 20, 2025
  14. modified the milestones: v0.28.5, v0.28.6 on Mar 5, 2025
  15. modified the milestones: v0.28.6, v0.28.7 on Mar 18, 2025
  16. modified the milestones: v0.28.7, v0.28.8 on Jul 28, 2025
  17. modified the milestones: v0.29.0, v0.29.1 on Dec 3, 2025
  18. removed this from the v0.30.0 milestone on Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageWaiting for discussion / prioritization by team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions