"DOS" line endings in Stingray TrafficScript rules


#1

Hi,

I am working at the moment on having chef to render templates for some
traffic script rules. One issue I’m running into is that when chef
renders the template the DOS line ending (CR (shows up as ^M in vim)) is
not rendering into the file. Is there a way to force chef to put that DOS
line ending into the output file?

— /tmp/test-pool 2012-12-09 14:18:06.501954361 +0000
+++ /opt/stingray/zxtm/conf/rules/virtualmin-sfo__choose-backend-pool
2012-12-06 19:43:58.088309481 +0000
@@ -1,4 +1,4 @@
-#=-chooses pool based on the path i.e. /amstel goes to webmin-amstel pool
+#=-chooses pool based on the path i.e. /amstel goes to webmin-amstel pool
$path = http.getPath();

Shared Hosts

Regards
–jm


Jacques Marneweck
http://www.powertrip.co.za/
http://www.powertrip.co.za/blog/
http://www.ataris.co.za/


#2

Does the source template have dos line endings (CRLF) that are getting
converted to unix endings (LF) by chef?

On Sun, Dec 9, 2012 at 9:39 AM, Jacques Marneweck jmarneweck@gmail.com wrote:

Hi,

I am working at the moment on having chef to render templates for some
traffic script rules. One issue I’m running into is that when chef renders
the template the DOS line ending (CR (shows up as ^M in vim)) is not
rendering into the file. Is there a way to force chef to put that DOS line
ending into the output file?

— /tmp/test-pool 2012-12-09 14:18:06.501954361 +0000
+++ /opt/stingray/zxtm/conf/rules/virtualmin-sfo__choose-backend-pool
2012-12-06 19:43:58.088309481 +0000
@@ -1,4 +1,4 @@
-#=-chooses pool based on the path i.e. /amstel goes to webmin-amstel pool
+#=-chooses pool based on the path i.e. /amstel goes to webmin-amstel pool
$path = http.getPath();

Shared Hosts

Regards
–jm


Jacques Marneweck
http://www.powertrip.co.za/
http://www.powertrip.co.za/blog/
http://www.ataris.co.za/


#3

On Sunday, December 9, 2012 at 3:32 PM, Jesse Campbell wrote:

Does the source template have dos line endings (CRLF) that are getting
converted to unix endings (LF) by chef?

When I was working on a different issue recently, I noticed inconsistent use of binmode among different file providers, which I resolved by adding binmode where it was missing.

I’d be interested to hear the answer to the above question, and I should also caution that line ending conversion behavior resulting from not using binmode should not be depended on.


Daniel DeLeo


#4

Hi,

Just the first line of the file has a DOS line ending (per the Zeus
TrafficScript spec).

Regards
–jm

On Mon, Dec 10, 2012 at 1:32 AM, Jesse Campbell hikeit@gmail.com wrote:

Does the source template have dos line endings (CRLF) that are getting
converted to unix endings (LF) by chef?

On Sun, Dec 9, 2012 at 9:39 AM, Jacques Marneweck jmarneweck@gmail.com
wrote:

Hi,

I am working at the moment on having chef to render templates for some
traffic script rules. One issue I’m running into is that when chef
renders
the template the DOS line ending (CR (shows up as ^M in vim)) is not
rendering into the file. Is there a way to force chef to put that DOS
line
ending into the output file?

— /tmp/test-pool 2012-12-09 14:18:06.501954361 +0000
+++ /opt/stingray/zxtm/conf/rules/virtualmin-sfo__choose-backend-pool
2012-12-06 19:43:58.088309481 +0000
@@ -1,4 +1,4 @@
-#=-chooses pool based on the path i.e. /amstel goes to webmin-amstel
pool
+#=-chooses pool based on the path i.e. /amstel goes to webmin-amstel
pool
$path = http.getPath();

Shared Hosts

Regards
–jm


Jacques Marneweck
http://www.powertrip.co.za/
http://www.powertrip.co.za/blog/
http://www.ataris.co.za/


Jacques Marneweck
http://www.powertrip.co.za/
http://www.powertrip.co.za/blog/
http://www.ataris.co.za/