Chef Best Practices: undefined method `[]’ for nil:NilClass

Typically you’ll get an error that looks like this: NoMethodError ————- undefined method `[]’ for nil:NilClass   Cookbook Trace: —————  /cookbooks/test/recipes/default.rb:15:in `from_file’   Relevant File Content: ———————- /cookbooks/test/recipes/default.rb:    12:  13:  puts “JPM Recipe start”  14:  puts node[‘att1’]  15>> puts node[‘att2’][‘att3’]  16: What just happened? Well, this recipe just referenced a sub-attribute (‘att3’) of a […]

Read more
A Rif on Knife Scripting Encrypted Databags

My colleague Rich Mills created a great post about a script to get PEM certs into databags. To sum up, the major issue was that the white space was interfering with the knife upload command. The knife script uses the ruby, some chef gems, ruby file manipulation, and the chef api to properly create the […]

Read more
Setting your knife.rb cookbook_path to match your cookbook locations

Always make sure you set your cookbook_path in knife.rb to something that makes sense for your working environment. People often get confused by how/where the ‘knife’ command is finding cookbooks during commands like “knife cookbook upload” or even “knife cookbooks create.” I remember when I first leaned Chef, I would type “knife cookbook create foo_book” […]

Read more
A Maturity Matrix for Continuous Delivery Pipelines

I’ve worked on a number of DevOps projects recently where I’ve had to assemble Continuous Delivery (CD) pipelines to build, deploy, and test software. In my case, we’ve been using Chef to automatically deploy various components of a java-based web system using Jenkins. We have a lot of pipeline job chains created in Jenkins to […]

Read more
What does Berkshelf do for me?

I’ve been doing a lot of work with Chef and Berkshelf over the last few years. I started in a world without Berkshelf and wrote a conglomeration of spaghetti cookbooks that had a mess of dependencies and were very difficult to maintain. Eventually, I bit the bullet and started using Berkshelf 2.0 to manage my […]

Read more
Setting up Chef Knife workstation to use multiple Chef servers

I have the problem of working against multiple open-source Chef servers to manage cookbooks, environments, etc in our continuous delivery pipeline. Chef and the “knife” tool, in general, like to use configuration information from ~/.chef/knife.rb. Within that file lies the all-important configuration item: chef_server_url. How do you deal with this if you’re working with multiple […]

Read more
What is Chef and why should I be using it?

Chef is a open source configuration and software integration framework that many organizations are actively investing in to simplify their operations.  Here at Coveros, we are using Chef to provision new instances of SecureCI. In many traditional organizations there is a natural division between our system administrators who are responsible for setting up servers and […]

Read more
X