Skip to content

Commit

Permalink
Make env.json valid json for test setup parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
neelimamukiri committed Feb 15, 2017
1 parent 8f1cc90 commit 3112498
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
10 changes: 5 additions & 5 deletions install/ansible/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"validate_certs": "no",
"cluster_store": "__CLUSTER_STORE__",
"auth_proxy_image": "contiv/auth_proxy:__API_PROXY_VERSION__",
"docker_reset_container_state": __RESET__,
"docker_reset_image_state": __RESET_IMAGES__,
"etcd_cleanup_state": __RESET__,
"auth_proxy_local_install": False,
"contiv_network_local_install": False
"docker_reset_container_state": "False",
"docker_reset_image_state": "False",
"etcd_cleanup_state": "False",
"auth_proxy_local_install": "False",
"contiv_network_local_install": "False"
}
8 changes: 8 additions & 0 deletions install/ansible/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@ echo '- include: install_auth_proxy.yml' >> $ansible_path/install_plays.yml
log_file_name="contiv_install_$(date -u +%m-%d-%Y.%H-%M-%S.UTC).log"
log_file="/var/contiv/$log_file_name"

# Ansible needs unquoted booleans but we need quoted booleans for json parsing.
# So remove quotes before sending to ansible and add them back after.
sed -i.bak "s#\"True\"#True#gI" "$env_file"
sed -i.bak "s#\"False\"#False#gI" "$env_file"
ansible-playbook $ans_opts -i "$host_inventory" -e "$(cat $env_file)" $ansible_path/install_plays.yml | tee $log_file
sed -i.bak "s#True#\"True\"#gI" "$env_file"
sed -i.bak "s#False#\"False\"#gI" "$env_file"
rm -rf "$env_file.bak*"

unreachable=$(grep "PLAY RECAP" -A 9999 $log_file | awk -F "unreachable=" '{print $2}' | awk '{print $1}' | grep -v "0" | xargs)
failed=$(grep "PLAY RECAP" -A 9999 $log_file | awk -F "failed=" '{print $2}' | awk '{print $1}' | grep -v "0" | xargs)

Expand Down
8 changes: 8 additions & 0 deletions install/ansible/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@ else
fi
log_file_name="contiv_uninstall_$(date -u +%m-%d-%Y.%H-%M-%S.UTC).log"
log_file="/var/contiv/$log_file_name"

# Ansible needs unquoted booleans but we need quoted booleans for json parsing.
# So remove quotes before sending to ansible and add them back after.
sed -i.bak "s#\"True\"#True#gI" "$env_file"
sed -i.bak "s#\"False\"#False#gI" "$env_file"
ansible-playbook $ans_opts -i "$host_inventory" -e "$(cat $env_file)" $ansible_path/uninstall_plays.yml | tee $log_file
sed -i.bak "s#True#\"True\"#gI" "$env_file"
sed -i.bak "s#False#\"False\"#gI" "$env_file"
rm -rf "$env_file.bak*"

unreachable=$(grep "PLAY RECAP" -A 9999 $log_file | awk -F "unreachable=" '{print $2}' | awk '{print $1}' | grep -v "0" | xargs)
failed=$(grep "PLAY RECAP" -A 9999 $log_file | awk -F "failed=" '{print $2}' | awk '{print $1}' | grep -v "0" | xargs)
Expand Down

0 comments on commit 3112498

Please sign in to comment.