I am using the latest postgresql cookbook from Chef supermarket.
On a VM with server recipe applied I can use resource postgresql_user
for example as follows
postgresql_user 'xldeploy' do
host 'database'
port 5432
user 'postgres'
password 'secret'
database 'postgres'
createdb true
end
On a node with only PostgreSQL client I cannot do the same. Provision will fail with
NoMethodError: undefined method `' for nil:NilClass
The error is in /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.13.11/lib/chef/resource.rb:1303
# If an unknown method is invoked, determine whether the enclosing Provider's
# lexical scope can fulfill the request. E.g. This happens when the Resource's
# block invokes new_resource.
def method_missing(method_symbol, *args, &block)
if enclosing_provider && enclosing_provider.respond_to?(method_symbol)
enclosing_provider.send(method_symbol, *args, &block)
else
raise NoMethodError, "undefined method `#{method_symbol}' for #{self.class}"
end
end
Am I using this resource the wrong way? Can it only be used on the PostgreSQL server? Not on a client?