Skip to content

feature(cloud-init): Added the ability to inject extra variables#84

Open
Wafffle77 wants to merge 2 commits into
mainfrom
cloud-init-render-inject
Open

feature(cloud-init): Added the ability to inject extra variables#84
Wafffle77 wants to merge 2 commits into
mainfrom
cloud-init-render-inject

Conversation

@Wafffle77
Copy link
Copy Markdown
Collaborator

Pull Request Template

Thank you for your contribution! Please ensure the following before submitting:

Checklist

  • My code follows the style guidelines of this project
  • I have added/updated comments where needed
  • I have added tests that prove my fix is effective or my feature works
  • I have run make test (or equivalent) locally and all tests pass
  • DCO Sign-off: All commits are signed off (git commit -s) with my real name and email
  • REUSE Compliance:
    • Each new/modified source file has SPDX copyright and license headers
    • Any non-commentable files include a <filename>.license sidecar
    • All referenced licenses are present in the LICENSES/ directory

Description

Adds the --extra-vars flag to ochami cloud-init group render to allow for injecting key-value pairs into the template renderer. The passed variables can be in any supported input format and can be passed directly, read from a file, or read from stdin.

Implements #82

Type of Change

  • New feature

For more info, see Contributing Guidelines.

Wafffle77 added 2 commits May 18, 2026 17:01
Signed-off-by: Ethan Clark <ethan.clark@trojans.dsu.edu>
Signed-off-by: Ethan Clark <ethan.clark@trojans.dsu.edu>
@Wafffle77 Wafffle77 changed the title feature(cloud-init): Added the ability to inject extra variables Signed-off-by: Ethan Clark <ethan.clark@trojans.dsu.edu> feature(cloud-init): Added the ability to inject extra variables May 18, 2026
Copy link
Copy Markdown
Collaborator

@synackd synackd left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I haven't tested this yet but have a couple of initial comments.


// Create flags
groupRenderCmd.Flags().VarP(&cli.FormatInput, "format-input", "f", "format of input payload data (json,json-pretty,yaml)")
groupRenderCmd.Flags().StringP("extra-vars", "", "", "extra variables to be passed to the template renderer or (if starting with @) file containing extra variables to be passed to the template renderer (can be - to read from stdin)")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should provide a shorthand if using StringP(), otherwise use String(). I would recommend using e as a shorthand flag here.

Also, the description is a bit long. To avoid too much wrapping, could we shorten it? Something like this to eliminate redundancy: "extra variables to be passed to the template renderer or (if starting with @) file containing extra variables (can be - to read from stdin)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since we are adding an extra flag here, we'll want to update the render command in the cloud-init(1) manual page with the flag, following the formatting conventions of the commands around it.

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