X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/faf8ae12e85eabb050b0f5eceb2cb67ad1de5261..66c8810de3626826ca758bf47b0def637254c97c:/cookbooks/postgresql/providers/extension.rb diff --git a/cookbooks/postgresql/providers/extension.rb b/cookbooks/postgresql/providers/extension.rb index 81a976004..875806990 100644 --- a/cookbooks/postgresql/providers/extension.rb +++ b/cookbooks/postgresql/providers/extension.rb @@ -17,6 +17,8 @@ # limitations under the License. # +use_inline_resources + def load_current_resource @pg = Chef::PostgreSQL.new(new_resource.cluster) @@ -29,14 +31,16 @@ end action :create do unless @pg.extensions(new_resource.database).include?(new_resource.extension) - @pg.execute(:command => "CREATE EXTENSION #{new_resource.extension}", :database => new_resource.database) - new_resource.updated_by_last_action(true) + converge_by "create extension #{new_resource.extension}" do + @pg.execute(:command => "CREATE EXTENSION #{new_resource.extension}", :database => new_resource.database) + end end end action :drop do if @pg.extensions(new_resource.database).include?(new_resource.extension) - @pg.execute(:command => "DROP EXTENSION #{new_resource.extension}", :database => new_resource.database) - new_resource.updated_by_last_action(true) + converge_by "drop extension #{new_resource.extension}" do + @pg.execute(:command => "DROP EXTENSION #{new_resource.extension}", :database => new_resource.database) + end end end