Skip to content

Instantly share code, notes, and snippets.

@aprice
Created November 30, 2017 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aprice/7995b5c4adf78a0bf4335e9cf6d00cc4 to your computer and use it in GitHub Desktop.
Save aprice/7995b5c4adf78a0bf4335e9cf6d00cc4 to your computer and use it in GitHub Desktop.
Simple utility for showing/cleaning up kitchen test instances that may have been forgotten.
#!/bin/bash
# Usage:
# mrclean - list kitchen instances in all cookbooks
# mrclean destroy - destroy kitchen instances in all cookbooks
# Update to your cookbook path
CBDIR=$HOME/chef-repo/cookbooks
for c in $CBDIR/*; do
echo $(basename $c)
cd $c
if [[ $1 == "destroy" ]]; then
kitchen destroy
else
kitchen list | grep -v "Not Created"
fi
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment