Adds key creation to the lint check to ensure that keys exist

This commit adds the `ssh_key_create` function to ensure that the key exists
on the host that the lint check is being run on. This allows the lint check
to continue on a node where it does not already have root ssh keys.

Change-Id: I64bed9e7aede1025b2c3f375ce1054696457be3a
Closes-Bug: #1424733
This commit is contained in:
Kevin Carter 2015-02-23 11:31:47 -06:00
parent 6b7e47822b
commit bee25839b9

View File

@ -25,24 +25,26 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $
info_block "Running Basic Ansible Lint Check" info_block "Running Basic Ansible Lint Check"
# Install the development requirements # Install the development requirements.
if [ -f "dev-requirements.txt" ]; then if [ -f "dev-requirements.txt" ]; then
pip2 install -r dev-requirements.txt || pip install -r dev-requirements.txt pip2 install -r dev-requirements.txt || pip install -r dev-requirements.txt
else else
pip2 install ansible-lint || pip install ansible-lint pip2 install ansible-lint || pip install ansible-lint
fi fi
# Perform our simple sanity checks # Create keys if they don't already exist.
ssh_key_create
# Perform our simple sanity checks.
pushd playbooks pushd playbooks
echo -e '[all]\nlocalhost ansible_connection=local' | tee local_only_inventory echo -e '[all]\nlocalhost ansible_connection=local' | tee local_only_inventory
# Do a basic syntax check on all playbooks and roles # Do a basic syntax check on all playbooks and roles.
info_block "Running Syntax Check" info_block "Running Syntax Check"
ansible-playbook -i local_only_inventory --syntax-check *.yml --list-tasks ansible-playbook -i local_only_inventory --syntax-check *.yml --list-tasks
# Perform a lint check on all playbooks and roles # Perform a lint check on all playbooks and roles.
info_block "Running Lint Check" info_block "Running Lint Check"
ansible-lint --version ansible-lint --version
ansible-lint *.yml ansible-lint *.yml
popd popd