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

command: add render command #13

Merged
merged 1 commit into from
Oct 10, 2017
Merged

Conversation

pmcatominey
Copy link
Contributor

allows testing how the template will be rendered

Fixes #9

@jrasell
Copy link
Member

jrasell commented Oct 6, 2017

Thanks for this @pmcatominey its awesome; I will try to find some day to take a proper look and merge/give feedback.

flags := c.Meta.FlagSet("build", FlagSetVars)
flags.Usage = func() { c.UI.Output(c.Help()) }

flags.StringVar(&addr, "address", "", "")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need address as the render command is not validating the job.

flags.Usage = func() { c.UI.Output(c.Help()) }

flags.StringVar(&addr, "address", "", "")
flags.StringVar(&log, "log-level", "INFO", "")
Copy link
Member

Choose a reason for hiding this comment

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

I doesn't seem like there is any logging except c.UI logs so this can be removed.

flags.StringVar(&addr, "address", "", "")
flags.StringVar(&log, "log-level", "INFO", "")
flags.StringVar(&variables, "var-file", "", "")
flags.StringVar(&outPath, "out", "-", "")
Copy link
Member

Choose a reason for hiding this comment

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

Could out default to "" rather than "-"?

var err error
var tpl *bytes.Buffer

flags := c.Meta.FlagSet("build", FlagSetVars)
Copy link
Member

Choose a reason for hiding this comment

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

"render" rather than "build". I will fix the error within the deploy Meta.FlagSet

@pmcatominey pmcatominey force-pushed the comand-render branch 2 times, most recently from 001e735 to 698bbed Compare October 9, 2017 10:43
tpl = bytes.NewBuffer(src)
break
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this break as it would skip the template call which is necessary to catch any missing interpolations

Render a Nomad job template, useful for debugging.

General Options:

Copy link
Member

Choose a reason for hiding this comment

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

Final thing; it looks like the Help is missing the -var-file variable description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, must have removed that when I culled the other options.

allows testing how the template will be rendered
@jrasell
Copy link
Member

jrasell commented Oct 10, 2017

Thanks very much @pmcatominey

@jrasell jrasell merged commit daced87 into hashicorp:master Oct 10, 2017
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.

None yet

2 participants