allow trailing newline in Jinja2 #1388

Merged
merged 1 commit into from Apr 7, 2016

Projects

None yet

4 participants

@aleiphoenix
Contributor

Jinja2 by default will trim a single trailing newline.

http://jinja.pocoo.org/docs/dev/templates/#whitespace-control

Most time we will need this trailing newline IMHO :)

@bitprophet
Member

Can you clarify when that kwarg was added to Jinja? tl;dr if this is going to change behavior unexpectedly for folks, I'd rather punt on it for now :) thanks!

@aleiphoenix
Contributor

Ah, how could I never think this change will break someone else.
I've changed the code, adding a 'keep_trailing_newline' kwargs, because it's False default to Jinja2 env.

@datashaman

I too have this problem. Files in /etc/cron.d must end in a newline (for some stupid reason), otherwise they do not take effect. My templates have that explicit newline, which is stripped out on deployment. So basically, deploying disables all application crons. Not ideal. :)

@bitprophet
Member

@datashaman Hah, gross. thanks for the useful feedback! (Not sarcasm.) Tossing this into a release bucket since it's small & decently sized impact for some use cases.

@bitprophet bitprophet added this to the 1.10.3 milestone Jan 5, 2016
@buzzijavier

I just ran into this issue today, with cron.. merge timeframe?? Came up with a hack, but still i rather not..

run('printf "\n" >> /tmp/user.crt') # run this after (in my case fabric upload_template)

@datashaman

If you're stuck with this issue ATM, it's easy enough to add another step
in your fabfile in the meantime:

sudo('echo "" >> /etc/cron.d/myfile')

On 26 January 2016 at 01:51, buzzijavier notifications@github.com wrote:

I just ran into this issue today, with cron.. merge timeframe??


Reply to this email directly or view it on GitHub
#1388 (comment).

@bitprophet bitprophet modified the milestone: 1.11, 1.10.3 Apr 7, 2016
@bitprophet bitprophet merged commit 445598a into fabric:master Apr 7, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bitprophet bitprophet added a commit that referenced this pull request Apr 7, 2016
@bitprophet bitprophet Doc+changelog updates re #1388 f721f01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment