Project

General

Profile

Actions

Feature #1425

open

Support for booleans in parameters

Added by Raffael Schmid over 12 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
External Nodes
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Hi

We had failures with our modules which depend on true/false as booleans (a string of "false" is still true...).
I just tested the support in puppet for booleans and it works.

How I tested this:

# site.pp
if $test == false {
  notice('$test is false')
}
if $test == true {
  notice('$test is true')
}
notice("\$test is $test (2nd)") 

# node terminus output
--- 
  parameters: 
    test: false

This gives me the following in syslog:

# syslog
Jan  3 12:14:44 puppetdev puppet-master[6259]: (Scope(Class[main])) $test is false
Jan  3 12:14:44 puppetdev puppet-master[6259]: (Scope(Class[main])) $test is false

I would suggest to add support for such things in the "Add parameters" form. Something like a drop-down to define the type (Boolean) and another drop-down for the value (true/false). This could be easily extended to be used for arrays/hashes as well...
As you can easily save such things via ActiveRecord, it should not be a problem on the database side. You just need to add another field and use 'serialize :fieldname' (see "Saving arrays, hashes, and other non-mappable objects in text columns" at http://api.rubyonrails.org/classes/ActiveRecord/Base.html).

Please tell me if you need some code or so...

Actions #1

Updated by Ohad Levy almost 6 years ago

  • Description updated (diff)
  • Assignee deleted (Ohad Levy)
  • Triaged set to No
Actions

Also available in: Atom PDF