Jira (PUP-10784) Augeas don't handle Deferred values

2020-11-18 Thread Frank (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Frank commented on  PUP-10784  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Augeas don't handle Deferred values   
 

  
 
 
 
 

 
 Hi Josh, yes will work, but that augeas muss be called many times, because changes of augeas needs an array.  
 
 
 
 
   $con_data = {  
 
 
 'host' => Deferred(load_file,[$db_host_file]),  
 
 
 'name' => Deferred(load_file,[$db_name_file]),  
 
 
 'user' => Deferred(load_file,[$db_user_file]),  
 
 
 'password' => Sensitive(Deferred(load_file,[$db_password_file]))  
 
 
   }  
 
 
   $settings = [  
 
 
 "set session-factory/property[#attribute/name='hibernate.connection.driver_class']/#text 'org.postgresql.Driver'",  
 
 
 "set session-factory/property[#attribute/name='hibernate.dialect']/#attribute/name 'hibernate.dialect'",  
 
 
 "set session-factory/property[#attribute/name='hibernate.dialect']/#text 'org.hibernate.dialect.PostgreSQLDialect'",  
 
 
 "set session-factory/property[#attribute/name='hibernate.jdbc.use_streams_for_binary']/#attribute/name 'hibernate.jdbc.use_streams_for_binary'",  
 
 
 "set 

Jira (PUP-10784) Augeas don't handle Deferred values

2020-11-17 Thread Josh Cooper (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Josh Cooper commented on  PUP-10784  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Augeas don't handle Deferred values   
 

  
 
 
 
 

 
 Frank the interpolation also needs to be deferred for that to work. One way to handle that is call inline_epp as a deferred function, using variables that are also deferred:  
 
 
 
 
 $variables = {  
 
 
   'db_host' => Deferred(load_file,[$db_host_file]),  
 
 
   'db_name' => Deferred(load_file,[$db_name_file])  
 
 
 }  
 
 
 augeas { 'sql':  
 
 
   ...  
 
 
   changes => Deferred('inline_epp', ["set session-factory/property[#attribute/name='hibernate.connection.url']/#text 'jdbc:postgresql://<%= \$db_host %>/<%= \$db_name %>'", $variables])  
 
 
 }
  
 
 
 
  The quoting starts to become complicated (note I had to escape $db_host), so it's better to put that in an EPP template.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 
  

Jira (PUP-10784) Augeas don't handle Deferred values

2020-11-17 Thread Frank (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Frank created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-10784  
 
 
  Augeas don't handle Deferred values   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 Functions  
 
 
Created: 
 2020/11/17 3:08 AM  
 
 
Priority: 
  Critical  
 
 
Reporter: 
 Frank  
 

  
 
 
 
 

 
 Puppet Version: puppet-agent-6.19.1-1.el7.x86_64 Puppet Server Version: puppetserver-6.14.1-1.el7.noarch OS Name/Version: CentOS 7.9 The augeas module don't handle Deferred values correct. Desired Behavior: That the value of the deferred function in inserted. Actual Behavior: Not the value, but the text ''Deferred({" is inserted. sample:  
 
 
 
 
 $db_host = Deferred(load_file,[$db_host_file])  
 
 
 $db_name = Deferred(load_file,[$db_name_file])  
 
 
 $settings = [  
 
 
   "set session-factory/property[#attribute/name='hibernate.connection.url']/#text 'jdbc:postgresql://${db_host}/${db_name}'"  
 
 
 ]