Chef undefined method ‘content_source’ error

The Problem If you’re running chef v2.1 you may have run into this bug. I’m running CentOS 6 in a VM and received the error when running “chef generate template webserver index.html”. This was my resulting error code: /opt/chefdk/embedded/apps/chef-dk/lib/chef-dk/skeletons/code_generator/recipes/template.rb:19:in `from_file’: undefined method `content_source’ for # (NoMethodError) from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/mixin/from_file.rb:30:in `instance_eval’ from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/mixin/from_file.rb:30:in `from_file’ from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/cookbook_version.rb:245:in `load_recipe’ […]

Checking Open Ports with Ruby

Below is the code for listing open ports on a windows box via Ruby. This line first lists all active connections via netstat. The find “LISTENING” section lists those ports in a listening state. The “find /V” looks for any line without “0.0.0.0”. This last part is important because many times Windows lists connections in […]