Open dvalfre opened 9 months ago
Steps to reproduce: 1) Create file /db/postgreql/entensions.json with the following structure:
/db/postgreql/entensions.json
{ "<dbname>": ["hstore"] }
2) Run Chef on the instance.
Desired output:
\dx
Current behavior:
================================================================================ Error executing action `run` on resource 'ruby_block[process extensions.json]' ================================================================================ NameError --------- uninitialized constant Chef::Resource::PostgresqlPgExtension Cookbook Trace: (most recent call first) ---------------------------------------- /etc/chef/recipes/cookbooks/ey-postgresql/recipes/server_configure.rb:280:in `block (3 levels) in from_file' /etc/chef/recipes/cookbooks/ey-postgresql/recipes/server_configure.rb:279:in `each' /etc/chef/recipes/cookbooks/ey-postgresql/recipes/server_configure.rb:279:in `block (2 levels) in from_file' Resource Declaration: --------------------- # In /etc/chef/recipes/cookbooks/ey-postgresql/recipes/server_configure.rb 275: ruby_block "process extensions.json" do 276: block do 277: # run_context = Chef::RunContext.new(node, {}) 278: exts = JSON.parse(::File.read(node["pg_extensions_file"])) 279: exts.each do |db_name, exts| 280: run_context.resource_collection << r = Chef::Resource::PostgresqlPgExtension.new("install #{exts.join(',')} in database #{db_name}", run_context) 281: r.db_name = db_name 282: r.ext_name = exts 283: end 284: end 285: only_if { ::File.exist?(node["pg_extensions_file"]) } 286: end 287:
Workaround: add the extensions by: 1) Connecting to the db engine; 2) Installing the desired extension(s) by running CREATE EXTENSION <extension_name>; 3) Checking the status by running \dx.
CREATE EXTENSION <extension_name>;
Steps to reproduce: 1) Create file
/db/postgreql/entensions.json
with the following structure:2) Run Chef on the instance.
Desired output:
\dx
.Current behavior: