Chef: Undefined node attribute or method `' on `node' when trying to add
Your problem is here:
node['postgresql']['pg_hba'] << {
This way you're accessing the attribute for reading.
Assuming you want to stay at default level you have to use default method like this:
node.default['postgresql']['pg_hba'] << { ... }
This will call default method (like in attribute file) to add the entry.
For this to work the first attribute declaration should be an array (or a hash of hash) like this:
default['postgresql']['pg_hba'] = [{ # notice the [ opening an array
:comment => '# IPv4 local connections',
:type => 'host',
:db => 'all',
:user => 'all',
:addr => '127.0.0.1/32',
:method => 'md5'
}] # Same here to close the array
ERROR: undefined method `python' for #Chef::Node::Attribute:0x00000003f78ef8
That cookbook (python
) is deprecated and does not work with Chef 13. Use poise-python
instead.
MySQL Chef: NoMethodError: undefined method `set' for #Chef::Node::Attribute
Found, it seems to be a compatibility issue between chef-client and mysql cookbook
By specifying in the Berksfile
cookbook 'mysql', '~> 7.0'
And in kitchen.yaml
product_name: chef
product_version: 14.12.9
Chef: undefined method `platform_version'
We removed the method syntax for node attributes in Chef 13. The code needs to be updated to node["platform_version"]
.
ChefSpec - Unable to set node attributes
You are able to set node attributes. If you look at the stacktrace, it's complaining about this line:
expect(chef_run).to create_directory("#{node['nginx']['dir']}")
Specifically, #{node['nginx']['dir']}
. You should use a static value here, otherwise your test is pointless. Change it to:
expect(chef_run).to create_directory('/etc/nginx')
Related Topics
How to Escape All Characters with Special Meaning in Regex
Delayedjob: "Job Failed to Load: Uninitialized Constant Syck::Syck"
Ruby on Rails - Helper Method - Undefined Method 'Log_In' in Ruby on Rails
Rails Cors Issue with Ajax API Endpoint Request
Delete from Database with Specific Details in Ruby
Rails Undefined Method 'Errors' for Nil:Nilclass in Simple_Form
Boot Up Rails App, Make Request to App from Outside Local Network
Create Multiple Records with Fields_For - Rails
How to Upgrade My Ruby 1.9.2-P0 to the Latest Patch Level Using Rvm
Possible to Access the Index in a Hash Each Loop
Replicating Xml Request with Savon/Ruby
To_SQL Not Working on Update_Attributes or .Save
Mongomapper Many to Many Issue with Array
How to Give a Date a Background Color with Axlsx
How to Use Local or Instance Variable in Ruby Code in Coffeescript in Haml Template