2.6.9, if it helps :) On Jul 18, 12:44 pm, tu2bg...@gmail.com wrote: > Hi all, > > Wonder if there is a quick answer to the following question: > > What I am trying to do is use the ymllookup function to get a list of php > ini values to set. > > php_ini: > engine: On > short_open_tag: On > asp_tags: Off > precision: 14 > y2k_compliance: On > output_buffering: Off > zlib.output_compression: Off > .... > > I want to pass that off to a set_php_ini define written in the ruby dsl so > I can loop through it. > > Here is an example of working test code: > require 'yaml' > > define "php::set_php_ini" do > > php_list = > YAML.load_file("/etc/puppet/manifests/extdata/node/hitw-gc-dev-web-1.example.com.yml") > php_type = "php_zend" > if php_type == 'php_net' > context = "files/etc/php.ini/PHP" > elsif php_type == 'php_zend' > context = "files/usr/local/zend/etc/php.ini/PHPZEND" > end > ini_data = php_list > ini_data['php_ini'].each_key do |k| > name = k > value = ini_data['php_ini'][k] > > augeas ("php_ini/#{name}"), > :context => context, > :onlyif => "get #{name} != #{value}", > :changes => "set #{name} #{value}" > end > end > > I then define my node with: > > php::set_php_ini {"set_php_ini": } > > And this works fine. > > However I can't seem to get it to pass the php_list to the define from my > puppet node declaration when I do the following: > node 'hitw-gc-dev-web-1' { > $php_list = ymllookup('php_ini') > php::set_php_ini {"set_php_ini": php_list => $php_list, php_type > => "php_zend"} > > } > > 45 define "php::set_php_ini", :php_list, :php_type do > 46 > 47 myphp_list = @php_list > 48 myphp_type = @php_type > 49 if myphp_type == 'php_net' > 50 context = "files/etc/php.ini/PHP" > 51 elsif myphp_type == 'php_zend' > 52 context = "files/usr/local/zend/etc/php.ini/PHPZEND" > 53 end > 54 ini_data = myphp_list > 55 > 56 ini_data['php_ini'].each_key do |k| > 57 name = k > 58 value = ini_data['php_ini'][k] > 59 > 60 augeas ("php_ini/#{name}"), > 61 :context => context, > 62 :onlyif => "get #{name} != #{value}", > 63 :changes => "set #{name} #{value}" > 64 end > 65 end > > err: Could not retrieve catalog from remote server: Error 400 on SERVER: > Puppet::Parser::Compiler failed with error NoMethodError: undefined method > `each_key' for nil:NilClass on node hitw-gc-dev-web-1.gdn.hitwise.com > > When I change the define to just do the following: > 56 notify @name, :message => ini_data > > notice: ibase.allow_persistent1error_reportingE_ALL & ~E_NOTICE & > ~E_USER_NOTICEsession.use_trans_sid0pgsql.max_persistent-1session.auto_start0mysqli.cache_size2000...y2k_compliancetruesession.hash_bits_per_character5track_errorsfalse' > notice: Finished catalog run in 0.14 seconds > > php_list appears to be a string rather than the hashes I expected. What am > I doing wrong? Also any tips to speed up the augeas code would be > appreciated. > > Cheers, > Den
-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.