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

RenderTemplate using the text/template package, not the html one #416

Merged
merged 3 commits into from
Jan 15, 2021
Merged

RenderTemplate using the text/template package, not the html one #416

merged 3 commits into from
Jan 15, 2021

Conversation

gianarb
Copy link
Contributor

@gianarb gianarb commented Jan 12, 2021

Description

Apparently, we imported the wrong package, we need to use text no HTML rules.

Why is this needed

Wrong import, we do not need to escape following HTML rules.
Fixes: #415

How Has This Been Tested?

Unit test

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

Gianluca Arbezzano added 2 commits January 12, 2021 21:58
A template does not need to be rendered with HTML escape, or at least
not at that layer. It was a mistake probably caused by a wrong
goimport.

Signed-off-by: Gianluca Arbezzano <[email protected]>
@gianarb gianarb added the ready-to-merge Signal to Mergify to merge the PR. label Jan 12, 2021
@codecov
Copy link

codecov bot commented Jan 12, 2021

Codecov Report

Merging #416 (b416c3a) into master (1f1ee52) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #416      +/-   ##
==========================================
+ Coverage   33.04%   33.08%   +0.04%     
==========================================
  Files          24       24              
  Lines        2170     2170              
==========================================
+ Hits          717      718       +1     
+ Misses       1377     1376       -1     
  Partials       76       76              
Impacted Files Coverage Δ
workflow/template_validator.go 82.08% <100.00%> (+1.49%) ⬆️

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 1f1ee52...b416c3a. Read the comment docs.

invidian
invidian previously approved these changes Jan 12, 2021
Copy link
Contributor

@invidian invidian left a comment

Choose a reason for hiding this comment

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

I guess it's sufficient to fix #415 👍

invidian
invidian previously approved these changes Jan 15, 2021
workflow/template_validator_test.go Outdated Show resolved Hide resolved
By default the html/template rendered an empty string when a variable is
not passed to the template.Execution. The text/template has a different
behavior. By default it prints `<no value>`. With this configuration now
it errors and tells that a variable is missed

Signed-off-by: Gianluca Arbezzano <[email protected]>
Copy link
Contributor

@gauravgahlot gauravgahlot left a comment

Choose a reason for hiding this comment

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

Thanks.

@gianarb gianarb requested review from invidian and removed request for invidian January 15, 2021 14:25
@mergify mergify bot merged commit 745c2d0 into tinkerbell:master Jan 15, 2021
@mmlb mmlb removed the ready-to-merge Signal to Mergify to merge the PR. label Jan 25, 2021
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.

Evaluating template in workflow replaced << with &lt;<
4 participants