[chef] RE: Re: RE: RE: Newlines in templates


Chronological Thread 
  • From: "THARP, JOSHUA L" < >
  • To: " " < >
  • Subject: [chef] RE: Re: RE: RE: Newlines in templates
  • Date: Wed, 6 Nov 2013 14:03:07 +0000
  • Accept-language: en-US

I am using Git, and with a little work (and a global setting that affects all repositories) I can have it change the newlines. However, the question remains if it is possible for Chef to do newline conversions. If I’m editing on a Windows PC, and I upload my cookbook – targeting a *nix platform – the cookbook is going to have the wrong line endings, and many Linux configuration files as well as shell interpreters are sensitive to the line endings. I would think mine is a fairly common scenario.

 

From: Martha Greenberg [mailto:
Sent: Tuesday, November 05, 2013 3:02 PM
To:
Subject: [chef] Re: RE: RE: Newlines in templates

 

Are you using Git?  If so, it is converting the checked out files for you.  See:

 

https://help.github.com/articles/dealing-with-line-endings


On Nov 5, 2013, at 21:17, "THARP, JOSHUA L" < "> > wrote:

Let me try to be more precise.

 

I’m reusing the simple_iptables community cookbook. That cookbook has a template that it uses to create the actual iptables configuration file. If I “knife cookbook upload simple_iptables” from a Windows machine and then use its LWRP from my cookbook (which has no templates of its own) the resulting iptables configuration file ends up with DOS newlines.

 

It seems like Chef should alter the type of newlines when a node is converged so that if you are converging a Linux box you get LF and a Windows box you get CR-LF.

 

From: Adam Edwards [ ">mailto: ]
Sent: Tuesday, November 05, 2013 10:55 AM
To: ">
Subject: [chef] RE: Newlines in templates

 

Joshua, which file has the DOS newlines – are you saying a template file in the simple_iptables cookbook has it? Or is the issue that your editor is doing DOS style newlines?

 

If it’s the latter, I think the simplest thing is to just configure the editor to do Unix line-endings. I get that that can still be challenging if there are multiple people working on these things and you need to enforce Unix-line endings for everyone.

 

-Adam

 

From: THARP, JOSHUA L [mailto: "> ]
Sent: Tuesday, November 5, 2013 10:28 AM
To: ">
Subject: [chef] Newlines in templates

 

I’m reusing the simple_iptables cookbook and working on a Windows PC for my workstation. My rules file is failing when I converge the node, and it tries to restart iptables. The problem seems to be the newlines in the file are DOS. For my own cookbooks I can set the newlines to always be UNIX, but I don’t want to edit a community cookbook. Is there a Chef/knife trick for ensuring that the template newlines are platform appropriate?




Archive powered by MHonArc 2.6.16.

§