Issue #14494 has been updated by Ian Ward.
Have there been no updates to this?
I am trying to perform a calculation against a fact in order to set some Linux
memory tunables to a percentage of the host's total RAM.
I created a fact, MemorySizeInKBytes and try to use it like this:
$min_free_kbytes = $::MemorySizeInKBytes * 0.03
sysctl::value { 'vm.min_free_kbytes': value => $min_free_kbytes }
However, when puppet runs, it gets this error:
Error 400 on SERVER: left operand of * is not a number
Per the Puppet 2.7 documentation, numbers are treated as strings until they are
used in a numeric context:
http://docs.puppetlabs.com/puppet/2.7/reference/lang_datatypes.html#numbers
And in fact, that same documentation page provides an example:
$some_number = 8 * -7.992
$another_number = $some_number / 4
The above example appears to work; however, what I am attempting (at top) fails.
----------------------------------------
Bug #14494: Puppet does not implicitly convert string to integer
https://projects.puppetlabs.com/issues/14494#change-93136
* Author: Mathias Nestler
* Status: Needs Decision
* Priority: Normal
* Assignee:
* Category:
* Target version: 2.7.15
* Affected Puppet version: 2.7.14
* Keywords:
* Branch:
----------------------------------------
I refer to my post on serverfault
(http://serverfault.com/questions/388944/how-to-convert-a-string-to-integer-in-puppet).
In short I have the following code:
$foo = '123'
$result = $foo % 2
Puppet give me an `Could not match %` error.
If I am using multiplication with this code:
$foo = '123'
$result = $foo * 2
I get a `left operand of * is not a number` error.
**Therefore it seems to be that there is an error with implicitly converting a
string to integer.**
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.