docker-archive / deploykit

A toolkit for creating and managing declarative, self-healing infrastructure.
Apache License 2.0
2.25k stars 262 forks source link

Support "MissingKey" template option #822

Closed kaufers closed 6 years ago

kaufers commented 6 years ago

By default, if a template map key is missing, the template rendering yields a String with <no value>. This commit adds support to pass the template MissingKey option, see: https://golang.org/pkg/text/template/#Template.Option

Note that the default behavior will not change; this is opt-in.

This commit also updates the enrollment and ingress controllers to use this new Option so that an error is raised.

Lastly, the var function is also updated to conditionally raise an error if the variable does not exist (if if MissingKey option is set to error).

Closes #821

codecov[bot] commented 6 years ago

Codecov Report

Merging #822 into master will decrease coverage by 0.03%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #822      +/-   ##
==========================================
- Coverage    47.2%   47.16%   -0.04%     
==========================================
  Files          89       89              
  Lines        7940     7944       +4     
==========================================
- Hits         3748     3747       -1     
- Misses       3832     3836       +4     
- Partials      360      361       +1
Impacted Files Coverage Δ
pkg/template/template.go 65.21% <100%> (+0.68%) :arrow_up:
pkg/core/object.go 63.82% <100%> (ø) :arrow_up:
pkg/rpc/mux/server.go 42.7% <0%> (-5.21%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6d084ca...30e2381. Read the comment docs.