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

Add format option for utils describe-stacks #2718

Merged
merged 2 commits into from Oct 16, 2020
Merged

Add format option for utils describe-stacks #2718

merged 2 commits into from Oct 16, 2020

Conversation

neha-viswanathan
Copy link
Contributor

@neha-viswanathan neha-viswanathan commented Oct 8, 2020

Closes #1495

Description

This MR enables the use of a flag output for the eksctl utils describe-stacks command for JSON or YAML formatted output.

How to run

eksctl utils describe-stacks --name=mycluster --output json

or

eksctl utils describe-stacks --name=mycluster --output yaml

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
  • Manually tested
  • Added labels for change area (e.g. area/nodegroup), target version (e.g. version/0.12.0) and kind (e.g. kind/improvement)
  • Make sure the title of the PR is a good description that can go into the release notes

Copy link
Collaborator

@cPu1 cPu1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few minor comments but otherwise LGTM.
Thanks for the PR!

pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
@cPu1 cPu1 added the kind/feature New feature or request label Oct 8, 2020
@neha-viswanathan neha-viswanathan changed the title print json formatted output for utils describe-stacks print formatted output for utils describe-stacks Oct 9, 2020
pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@michaelbeaumont michaelbeaumont dismissed their stale review October 13, 2020 19:06

taken care of, waiting on @cPu1 response

cmdutils.AddTimeoutFlag(fs, &cmd.ProviderConfig.WaitTimeout)
})

cmdutils.AddCommonFlagsForAWS(cmd.FlagSetGroup, &cmd.ProviderConfig, false)
}

func doDescribeStacksCmd(cmd *cmdutils.Cmd, all, events, trail bool) error {
func doDescribeStacksCmd(cmd *cmdutils.Cmd, all, events, trail bool, printer printers.OutputPrinter, output printers.Type) error {
if output != "" && (all || events || trail) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do the validation in RunE, and using flag.Changed (or CobraCommand.Flags.Changed()) is more accurate.

@neha-viswanathan
Copy link
Contributor Author

@cPu1 thanks a lot for your suggestions. I appreciate your guidance.

Copy link
Collaborator

@cPu1 cPu1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the proposed changes 🎉 . I've suggested some minor improvements and the PR is good to merge after they're resolved.

pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
pkg/ctl/utils/describe_stacks.go Outdated Show resolved Hide resolved
@michaelbeaumont michaelbeaumont merged commit 0620835 into eksctl-io:master Oct 16, 2020
@michaelbeaumont michaelbeaumont changed the title print formatted output for utils describe-stacks Add format option for utils describe-stacks Oct 16, 2020
@neha-viswanathan neha-viswanathan deleted the 1495-stacks-json-output branch October 16, 2020 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offer utils describe-stacks output in pure JSON
3 participants