Why are you trying to write a recipe within a ruby block ? I can't see a use case (but tell me if you find one). You may do the same thing directly within the recipe as they are ruby code too. Le 2014-12-18 18:05, a écrit : My code ruby_block "install pg" do block do if !node[:installed][:postgres] package "postgres" do version "9.3" action :install provider Chef::Provider::Package::Apt end template "/etc/postgresql/9.3/main/pg_hba.conf" do source "pg_hba.conf.erb" mode 0660 user "postgres" group "postgres" end execute "createdb ucmsdb" do user "postgres" not_if "psql --list | grep -v grep | grep ucmsdb", :user => "postgres" end node.set[:installed][:postgres] = true end end ============================================================================ ==== Error executing action `run` on resource 'ruby_block[install postgres]' ============================================================================ ==== NoMethodError ------------- undefined method `apt_package' for Chef::Resource::RubyBlock Cookbook Trace: --------------- /var/chef/cache/cookbooks/pgdb/recipes/default.rb:48:in `block (2 levels) in from_file' Compiled Resource: ------------------ # Declared in /var/chef/cache/cookbooks/pgdb/recipes/default.rb:44:in `from_ file' ruby_block("install postgres") do action "run" retries 0 retry_delay 2 guard_interpreter :default block_name "install postgres" cookbook_name "pgdb" recipe_name "default" block #<Proc:0x000000030f6650@/var/chef/cache/cookbooks/pgdb/recipes/defau lt.rb:45> end Running handlers: Running handlers complete Chef Client failed. 0 resources updated in 8.434211777 seconds Please help Thanx
|
Archive powered by MHonArc 2.6.16.