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

allow trailing newline in Jinja2 #1388

Merged
merged 1 commit into from Apr 7, 2016

Conversation

Projects
None yet
4 participants
@aleiphoenix

aleiphoenix commented Oct 12, 2015

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

This comment has been minimized.

Member

bitprophet commented Oct 26, 2015

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!

80x24
@aleiphoenix

This comment has been minimized.

aleiphoenix commented Nov 26, 2015

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

This comment has been minimized.

datashaman commented Jan 5, 2016

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

This comment has been minimized.

Member

bitprophet commented Jan 5, 2016

@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

This comment has been minimized.

buzzijavier commented Jan 25, 2016

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

This comment has been minimized.

datashaman commented Jan 26, 2016

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 milestones: 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 added a commit that referenced this pull request Apr 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment