Support utf-8 for config templates
ClosedPublic

Authored by thcipriani on Jul 2 2018, 5:57 PM.

Details

Reviewers
mmodell
dduvall
Pchelolo
mobrovac
Group Reviewers
Release-Engineering-Team
Commits
rMSCA16517a84742e: Support utf-8 for config templates
Patch without arc
git checkout -b D1077 && curl -L https://phabricator.wikimedia.org/D1077?download=true | git apply
Summary

Ensure that each template is stored as unicode in the Jinja template
loader. After rendering, encode unicode to a string that can be written
to the rendered config file.

Bug: T198621

Test Plan

See added tests

Diff Detail

Repository
rMSCA Scap
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
thcipriani created this revision.Jul 2 2018, 5:57 PM
Restricted Application added a reviewer: Release-Engineering-Team. · View Herald TranscriptJul 2 2018, 5:57 PM
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript
thcipriani requested review of this revision.Jul 2 2018, 5:59 PM
Pchelolo accepted this revision.Jul 3 2018, 9:18 AM

I'm not a big expert in Scap codebase, but seems fine at the first glance

This revision is now accepted and ready to land.Jul 3 2018, 9:18 AM
mobrovac added inline comments.Jul 3 2018, 11:36 AM
tests/scap/test_template.py
2

Shouldn't this line be present in the code files handling the templates as well? Put it another way, why do we need them here in the tests, but not in the other parts of the code?

thcipriani added inline comments.Jul 3 2018, 4:39 PM
tests/scap/test_template.py
2

It's present in the code that handles templates already: https://github.com/wikimedia/scap/blob/master/scap/template.py#L1

I added it here because it was missing (since it was a test file and we've been less strict about it), and, of course, because python complains when you add a non-ascii character to file ( and ) without declaring an encoding.

mobrovac accepted this revision.Jul 3 2018, 5:33 PM

LGTM +1

tests/scap/test_template.py
2

Ah, must have missed it, sorry about that :P

mmodell accepted this revision.Jul 3 2018, 8:12 PM
This revision was automatically updated to reflect the committed changes.