Skip to content

Instantly share code, notes, and snippets.

@iammoen
Created January 27, 2020 16:45
Show Gist options
  • Save iammoen/779c0241de3205442096ec2550e8c8c7 to your computer and use it in GitHub Desktop.
Save iammoen/779c0241de3205442096ec2550e8c8c7 to your computer and use it in GitHub Desktop.
A function that I put in my .zsrhc file to allow quick test kitchen commands
tk() {
additionalParams="${@:2}"
if [ "$1" = "dc" ]
then
echo "exec: kitchen destroy ${additionalParams} && kitchen converge ${additionalParams}"
kitchen destroy ${additionalParams} && kitchen converge ${additionalParams}
elif [ "$1" = "l" ]
then
echo "exec: kitchen list ${additionalParams}"
kitchen list ${additionalParams}
elif [ "$1" = "c" ]
then
echo "exec: kitchen converge ${additionalParams}"
kitchen converge ${additionalParams}
elif [ "$1" = "d" ]
then
echo "exec: kitchen destroy ${additionalParams}"
kitchen destroy ${additionalParams}
elif [ "$1" = "v" ]
then
echo "exec: kitchen verify ${additionalParams}"
kitchen verify ${additionalParams}
elif [ "$1" = "cv" ]
then
echo "exec: kitchen converge ${additionalParams} && verify ${additionalParams}"
kitchen converge ${additionalParams} && kitchen verify ${additionalParams}
elif [ "$1" = "dv" ]
then
echo "exec: kitchen destroy ${additionalParams} && verify ${additionalParams}"
kitchen destroy ${additionalParams} && kitchen verify ${additionalParams}
elif [ "$1" = "rspec" ]
then
echo "exec: chef exec rspec --color spec/unit/recipes/default_spec.rb"
chef exec rspec --color spec/unit/recipes/default_spec.rb
else
echo "exec: kitchen $1"
kitchen $1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment