CHEF to check CHEF


I have a query regarding CHEF; please suggest if have any thought about this.

As part of tech remediation, we are migrating all RHEL5 machines to RHEL7.

This activity needs to be performed on thousands of servers.

Migration activity will commonly have; package install, folder create, mount create, user access, etc.

My requirement is to check whether the recipe performed the action correctly.

For e.g. if we have a folder creation recipe, once it gets converged to the target node; how can we programmatically confirm that the folder was created with the correct name, location, owner, group, permission.

I want to check this for all types of resources on the target node.

PS: As per my understanding chefSpec, Kitchen, InSpec does not exactly fit my requirement as i need to check on the actual target host.


Inspec does run on the target hosts. And resource tests is what it does. Have you checked out ?
In your file case this is what it would look like. You can test all the attributes of the file.

describe file('path') do
it { should PROPERTY 'value' }


I have decided to implement this as below:

# Creating folder

directory path do
  recursive true
  action :create

# Logging the status if the folder is created
log "[#{role}][#{recipe_name}]: Folder '#{path}' creation - OK" do
  only_if { Dir.exist?(path) }

I need to do similar checks for folder permission, and owner. Can you please suggest if there is any way to check/verify folder attributes?