Skip to content

Commit

Permalink
uppercase BOX variable.
Browse files Browse the repository at this point in the history
uncomment INVENTORY variable.
comment puts statements in Vagrantfile.
  • Loading branch information
steenzout committed Apr 30, 2015
1 parent d8bfb40 commit 5896837
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions tests/Vagrantfile
Expand Up @@ -7,32 +7,32 @@ CONFIGURATION_FILE = 'group_vars/all.yml'

Vagrant.configure('2') do |config|

puts "[INFO] loading box settings from #{CONFIGURATION_FILE}..."
# puts "[DEBUG] loading box settings from #{CONFIGURATION_FILE}..."
vagrant_environment = YAML.load_file(File.expand_path(CONFIGURATION_FILE, File.dirname(__FILE__)))

vagrant_environment['vagrant'].each do |box_name, box_settings|
if not box_settings['enabled']
puts "[INFO] #{box_name} is not enabled. skipping..."
# puts "[DEBUG] #{box_name} is not enabled. skipping..."
next
end

puts "[INFO] applying #{box_name} settings..."
# puts "[DEBUG] applying #{box_name} settings..."
config.vm.define "#{box_name}" do |host|

host.vm.box = box_settings['box'] unless not box_settings.key? 'box'
host.vm.hostname = box_name

host.vm.network box_settings['network']['name'], ip: box_settings['network']['ip'] unless box_settings.key? 'network'

puts "[INFO] applying virtualbox provider settings for #{box_name} box..."
# puts "[DEBUG] applying virtualbox provider settings for #{box_name} box..."
config.vm.provider "#{box_settings['provider']}" do | provider |
box_settings['provider'].each do |key, value|
next if key == 'name'
provider.send("#{key}=", value)
end
end

puts "[INFO] provisioning #{box_name} using ansible vagrant playbook..."
# puts "[DEBUG] provisioning #{box_name} using ansible vagrant playbook..."
config.vm.provision 'ansible' do |ansible|
ansible.playbook = PLAYBOOK
ansible.verbose = 'v'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_idempotence.sh
Expand Up @@ -33,7 +33,7 @@ NC='\033[0m'
# the logfile to hold the output of the playbook run
LOGFILE="log/${BOX}_${VIRTUALENV_NAME}.log"

echo "[INFO] #{BOX} ${VIRTUALENV_NAME} running idempotence test..."
echo "[INFO] ${BOX} ${VIRTUALENV_NAME} running idempotence test..."
ansible-playbook -i ${INVENTORY} --limit ${BOX} ${PLAYBOOK} 2>&1 | tee ${LOGFILE} | \
grep "${BOX}" | grep -q "${PASS_CRITERIA}" && \
echo -ne "[TEST] ${BOX} ${VIRTUALENV_NAME} idempotence : ${GREEN}PASS${NC}\n" || \
Expand Down
8 changes: 4 additions & 4 deletions tests/vagrant.sh
Expand Up @@ -26,8 +26,8 @@ source environment.sh
# NOTE: PLAYBOOK must be the same value as defined in the Vagrantfile.
PLAYBOOK="vagrant.yml"

# A default inventory file is automatically generated by Vagrant @
# INVENTORY=${DIR}/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
# Inventory file to run tests againt (points to Vagrant generated inventory)
INVENTORY=${DIR}/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory


while [[ $# > 1 ]]
Expand Down Expand Up @@ -83,7 +83,7 @@ export ANSIBLE_ASK_SUDO_PASS=True
for BOX in `grep vagrant.dev group_vars/all.yml | sed 's/://g'`
do

echo "[INFO] preparing ${box}..."
echo "[INFO] preparing ${BOX}..."
vagrant up ${BOX} 2> /dev/null
if [ $? -ne 0 ]; then
# box not enabled
Expand All @@ -92,6 +92,6 @@ do

. test_idempotence.sh

echo "[INFO] destroying ${BOX}..."
echo "[INFO] destroy ${BOX}..."
vagrant destroy -f ${BOX}
done

0 comments on commit 5896837

Please sign in to comment.