Skip to content

cli: add -json and -t flags to operator autopilot get-config#27991

Open
singhvishalkr wants to merge 1 commit into
hashicorp:mainfrom
singhvishalkr:cli-autopilot-get-config-json-template
Open

cli: add -json and -t flags to operator autopilot get-config#27991
singhvishalkr wants to merge 1 commit into
hashicorp:mainfrom
singhvishalkr:cli-autopilot-get-config-json-template

Conversation

@singhvishalkr
Copy link
Copy Markdown

I noticed that nomad operator autopilot get-config is missing the -json and -t flags that other inspection commands have. Scripting and automation tools benefit from machine-readable output instead of parsing the default key=value lines.

This PR adds both flags following the same pattern used by nomad server members and other commands:

  • -json outputs the full AutopilotConfiguration struct as JSON
  • -t accepts a Go template for custom formatting

Two tests are included to verify the JSON unmarshals correctly and that templates work as expected.

Addresses #15894 (partial)

The operator autopilot get-config command now supports structured output
via the -json flag for JSON format and the -t flag for Go template
formatting, matching the pattern used by other Nomad CLI commands.

Addresses hashicorp#15894
@singhvishalkr singhvishalkr requested review from a team as code owners May 16, 2026 09:11
@hashicorp-cla-app
Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

1 similar comment
@hashicorp-cla-app
Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@singhvishalkr
Copy link
Copy Markdown
Author

I have read and signed the CLA.

@tgross
Copy link
Copy Markdown
Member

tgross commented May 18, 2026

@singhvishalkr to get the CLA bot to approve, you need to have signed with the same email address as the commit. (See https://patch-diff.githubusercontent.com/raw/hashicorp/nomad/pull/27991.patch if you're not sure which one that is)

@singhvishalkr
Copy link
Copy Markdown
Author

@tgross Every commit on this branch already lists vishal.kr.singh2021@gmail.com as author email. If the CLA badge still shows pending, I will trigger the HashiCorp CLA recheck after the next sync; the address matches what I used when signing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants