Issue #12695 has been updated by Daniel Pittman.

Status changed from Unreviewed to Closed

Hey.  Congratulations, you found one of the reasons I consider YAML a bad 
choice for data representation, the magic.  Oh, the magic.

You didn't actually give a string there, you gave a Boolean; the definition is 
pretty liberal, and this documents it pretty well: 
http://www.perlmonks.org/?node_id=738671

To quote:

<pre>
Ruby’s yaml.rb

y                                              -> 'y'
Y                                              -> 'Y'
Yes, Yes, YES, true, True, TRUE, on, On, ON    -> true
n                                              -> 'n'
N                                              -> 'N'
no, No, NO, false, False, FALSE, off, Off, OFF -> false
19:59 -> 1199
</pre>

This is, sadly, something we can't solve directly in Puppet while that data 
exchange layer is YAML.  You just have to emit quoted strings in your ENC.
----------------------------------------
Bug #12695: Parameter value changed from On to true when using the external 
node classifier.
https://projects.puppetlabs.com/issues/12695#change-55394

Author: Jason Smith
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.6.13
Keywords: 
Branch: 


I recently noticed that when using the puppet external node classifier with our 
own database and custom script to output YAML, if a parameter has a value of 
**On**, it will be changed to **true** when the manifest is run on the node. I 
tried several other values, including **Off** and none were changed, only 
**On**. The script we are using doesn't quote the YAML strings by default, but 
as a work-around for this, I found an option for the YAML library which makes 
it dump quoted strings. Using the puppet dashboard (version 1.1.1) does not 
have a problem either since it seems to quote parameter value strings in the 
YAML it outputs. Since I believe unquoted strings are allowed in YAML, this 
must be a bug in puppet or a ruby library that it is using, so I figured I 
would report it even though I found a way around it.

To reproduce this with a simple test case, I have a test module in our manifest 
directory:
<pre>
# cat test/manifests/init.pp 
class test {
  $msg = "Test parameter: \$test_parameter=$test_parameter"
  alert($msg)
  notify { "test_parameter_value":
    message => $msg,
  }
}
</pre>
In our asset database, I have the classes and parameters configured so our 
external node classifier produces this YAML output for my test node:
<pre>
---
classes:
  - test
environment: testing
parameters:
  test_parameter: On
</pre>
When running the above test manifest on our test node, I get this result:
<pre>
# puppet agent --test --environment=testing
info: Applying configuration version '2a3ead2'
notice: Test parameter: $test_parameter=true
notice: /Stage[main]/Test/Notify[test_parameter_value]/message: defined 
'message' as 'Test parameter: $test_parameter=true'
notice: Finished catalog run in 0.38 seconds
</pre>
As you can see, the *test_parameter* value was changed from **On** to **true**.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to