Preserve line returns in Global Variables (to support YAML)

18 views
Skip to first unread message

Ben West

unread,
Oct 10, 2016, 4:07:19 PM10/10/16
to scalr-discuss
I'm curious if there is a way to preserve '\n' line returns in a Global Variable, specifically so that one can pass YAML to launched servers.

Testing on a copy of Scalr v5.10 seems to indicate the line returns being stripped, and it looks like the printf format string field can't be used prevent that stripping.

Daniele Testa

unread,
Oct 10, 2016, 6:11:52 PM10/10/16
to scalr-...@googlegroups.com
Try putting the command "env" in a Scalr Script and see if the new-lines are really cut.

If you use "echo" to print the variable, make sure that you use "echo -e" to enable new-line conversion.

On Tue, Oct 11, 2016 at 4:07 AM, Ben West <westb...@gmail.com> wrote:
I'm curious if there is a way to preserve '\n' line returns in a Global Variable, specifically so that one can pass YAML to launched servers.

Testing on a copy of Scalr v5.10 seems to indicate the line returns being stripped, and it looks like the printf format string field can't be used prevent that stripping.

--
You received this message because you are subscribed to the Google Groups "scalr-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalr-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
Daniele Testa | Sr. Solutions Architect @ Scalr | dan...@scalr.com | www.scalr.com | blog.scalr.com

Ben West

unread,
Oct 11, 2016, 2:56:09 PM10/11/16
to scalr-...@googlegroups.com
Actually, turns out the issue is with Scalr web UI stripping newlines from default variable values populated at lower scopes.  When I create a global variable with default value, the correctly formatted YAML looks like this:

Inline image 2

If I then want to override that variable at the farm or server scope, the default value turns into this:
Inline image 3


The global-scope default value does render correctly on luanched servers, i.e. szradm queryenv list-global-variables displays this:

<variable name="CUSTOM_YAML" private="0">---
blah: blahblah
blah2: blah2blah2
blah3:
  blah3.1:
   blah3.1.1: blah3.1.1_value</variable>

So, the web UI is stripping newlines when it populates default values for global variables at lower scopes.  This appears to not effect the values actually passed for those variables to launched servers, unless someone unwittingly saves the default value when overriding that variable at farm or server scope.

This seems like a rather subtle sharp edge on the web UI.







--
You received this message because you are subscribed to a topic in the Google Groups "scalr-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalr-discuss/6PvsxNq5QEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalr-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Ben West

unread,
Oct 12, 2016, 11:32:02 AM10/12/16
to scalr-discuss, m...@benwest.name
Following up that I created an issue on Scalr github:
https://github.com/Scalr/scalr/issues/80


On Tuesday, October 11, 2016 at 1:56:09 PM UTC-5, Ben West wrote:
Actually, turns out the issue is with Scalr web UI stripping newlines from default variable values populated at lower scopes.  When I create a global variable with default value, the correctly formatted YAML looks like this:

Inline image 2

If I then want to override that variable at the farm or server scope, the default value turns into this:
Inline image 3


The global-scope default value does render correctly on luanched servers, i.e. szradm queryenv list-global-variables displays this:

<variable name="CUSTOM_YAML" private="0">---
blah: blahblah
blah2: blah2blah2
blah3:
  blah3.1:
   blah3.1.1: blah3.1.1_value</variable>

So, the web UI is stripping newlines when it populates default values for global variables at lower scopes.  This appears to not effect the values actually passed for those variables to launched servers, unless someone unwittingly saves the default value when overriding that variable at farm or server scope.

This seems like a rather subtle sharp edge on the web UI.






On Mon, Oct 10, 2016 at 5:11 PM, Daniele Testa <dan...@scalr.com> wrote:
Try putting the command "env" in a Scalr Script and see if the new-lines are really cut.

If you use "echo" to print the variable, make sure that you use "echo -e" to enable new-line conversion.
On Tue, Oct 11, 2016 at 4:07 AM, Ben West <westb...@gmail.com> wrote:
I'm curious if there is a way to preserve '\n' line returns in a Global Variable, specifically so that one can pass YAML to launched servers.

Testing on a copy of Scalr v5.10 seems to indicate the line returns being stripped, and it looks like the printf format string field can't be used prevent that stripping.

--
You received this message because you are subscribed to the Google Groups "scalr-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalr-discus...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Regards,
Daniele Testa | Sr. Solutions Architect @ Scalr | dan...@scalr.com | www.scalr.com | blog.scalr.com

--
You received this message because you are subscribed to a topic in the Google Groups "scalr-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalr-discuss/6PvsxNq5QEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalr-discus...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Marc O'Brien

unread,
Oct 12, 2016, 11:55:37 AM10/12/16
to scalr-discuss, m...@benwest.name
Hi Ben,

Thank you for the collaboration on this issue.  We are looking at this internally for resolution in a future version of Scalr.

Your efforts are much appreciated.  Please let us know if you run in to anything else moving forward.

Cheers,
Wm. Marc O'Brien
Scalr Technical Support
Reply all
Reply to author
Forward
0 new messages