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

Prevent non-supplied variables from breaking -fillTemplates #138

Open
dilyand opened this issue Oct 16, 2018 · 2 comments
Open

Prevent non-supplied variables from breaking -fillTemplates #138

dilyand opened this issue Oct 16, 2018 · 2 comments

Comments

@dilyand
Copy link

dilyand commented Oct 16, 2018

With templateable playbooks, we can pass arguments to be replaced in the playbook via the -var flag. However, if we miss one of those, then the -fillTemplates functionality won't work.

For example:

:targets:
  - :name:      "Redshift"
    :type:         "redshift"
    :host:         "hostname"
    :database: "snowplow"
    :port:          5439
    :username: "datamodeling"
    :password:  {{secret "redshift-datamodeling-password"}}
:variables:
  :first_day_of_prev_month_YYYY_MM_DD: {{.start}}
  :prev_month_YYYY_MM: {{.month}}
  :first_day_of_this_month_YYYY_MM_DD: {{.end}}
:steps:
...

It's easy to miss that you need to supply a value for password. It does not look like the other variables ({{var}} vs {{.var}}) and it is in another section of the playbook. But if you do not supply a value for it, then -fillTemplates won't print out the SQL queries, even though you're passing all the values that are required for that:

λ:> ./sql-runner -dryRun -playbook ./playbooks/playbook.yml.tmpl -sqlroot ./sql -var start=$(gdate -d "$(gdate +%Y-%m-01) -1 month" +%Y-%m-%d),month=$(gdate -d "$(gdate +%Y-%m-01) -1 month" +%Y-%m),end=$(gdate +%Y-%m-01) -fillTemplates

2018/10/15 16:24:43 WARNING: No queries to run

(That warning message is also not very helpful.)

@alexanderdean
Copy link
Member

Are you talking about non-supplied variables in general, or a missing password specifically? As you say, they are distinct things.

@dilyand
Copy link
Author

dilyand commented Oct 16, 2018

Any non-supplied variable has the same effect. Missing password is just a highly likely scenario.

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

No branches or pull requests

2 participants