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

allow trailing newline in Jinja2 #1388

Merged
merged 1 commit into from Apr 7, 2016
Merged

allow trailing newline in Jinja2 #1388

merged 1 commit into from Apr 7, 2016

Conversation

sp3c73r2038
Copy link

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
Copy link
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!

@sp3c73r2038
Copy link
Author

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
Copy link

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
Copy link
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
Copy link

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
Copy link

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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants