Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support machine-readable output for tsh ls #3660

Closed
webvictim opened this issue May 3, 2020 · 4 comments · Fixed by #4390
Closed

Support machine-readable output for tsh ls #3660

webvictim opened this issue May 3, 2020 · 4 comments · Fixed by #4390
Assignees
Labels
c-sn Internal Customer Reference feature-request Used for new features in Teleport, improvements to current should be #enhancements good-starter-issue Good starter issue to start contributing to Teleport tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Comments

@webvictim
Copy link
Contributor

Feature Request

The output of tsh ls is not easily readable by any kind of automated process at the moment.

It'd be great to add a flag to get JSON-formatted output from tsh ls that could be leveraged to make the output more usable by automated processes. The label output from nodes in particular is hard to process because it has variable length.

Motivation

A customer requested this and I thought it was a good idea.

Who's it for?

OSS User, Pro, Enterprise

@webvictim webvictim added feature-request Used for new features in Teleport, improvements to current should be #enhancements tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels May 3, 2020
@benarent benarent added the c-sn Internal Customer Reference label May 19, 2020
@benarent
Copy link
Contributor

benarent commented May 19, 2020

+1 from another customer, to add JSON Output. They would then use an Ansible script to automate upgrading of specific nodes. e.g. Version=!4.2.9

I would propose tsh ls --output=json , this is a similar patten to AWS CLI. --query is another interesting implementation that we might want to consider for larger customers.

Also TIL https://jmespath.org/

@webvictim
Copy link
Contributor Author

I think JSON output is a great target in the short term as we've had a number of requests for that output format.

We have had one request for --query type usage that I know of, but I've always preferred sticking to the Unix Philosophy - "make each program do one thing well". jq's filtering is way better than anything we could build in tsh natively.

@awly
Copy link
Contributor

awly commented May 20, 2020

JSON with jq is a good generic solution.
Where possible, we can consider plaintext output too. For example tsh ls can output node names, one per line:

$ for node in $(tsh ls --output=text); do
  tsh ssh ${node} uptime
done

That way many use-cases don't need jq.

@russjones
Copy link
Contributor

#1696

@russjones russjones assigned Joerger and unassigned webvictim Sep 23, 2020
@russjones russjones added the good-starter-issue Good starter issue to start contributing to Teleport label Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-sn Internal Customer Reference feature-request Used for new features in Teleport, improvements to current should be #enhancements good-starter-issue Good starter issue to start contributing to Teleport tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants