Project

General

Profile

Feature #1425

Updated by Ohad Levy over 6 years ago

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: 
 
 <pre> 
 
 # site.pp 
 
 if $test == false { 
   
   notice('$test is false') 
 
 } 
 
 if $test == true { 
   
   notice('$test is true') 
 
 } 
 
 notice("\$test is $test (2nd)")  
  
 </pre> 

 

 <pre> 
 
 # node terminus output 
 
 ---  
    
   parameters:  
      
     test: false 
 
 </pre> 

 

 This gives me the following in syslog: 
 
 <pre> 
 
 # 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 
 
 </pre> 


 


 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...

Back