From bf99d50427647fe915236ea1d26d52646edeb565 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 18 Nov 2014 13:56:08 +0000 Subject: Fix Mason deployments for non-openstack-testing Mason In mason.configure: It's not needed to create a separate os.conf file at this point. In this file we were puting OpenStack credentials used to create an os.conf file with Ansible. This file was only created when TEST_INFRASTRUCTURE_TYPE was 'openstack', and Ansible was expecting it always. This patch moves the OpenStack credentials to mason.conf, so Ansible only have to read the variables from one file. In mason.sh: The script was always loading /etc/os.conf. This file is only created when TEST_INFRASTRUCTURE_TYPE is 'openstack'. This patch checks that the file exists before loading it. In mason.conf template for Ansible. OPENSTACK_NETWORK_ID is only present when TEST_INFRASTRUCTURE_TYPE is 'openstack'. This patch adds a conditon in the template to skip this value if it doesn't exist. --- mason.configure | 2 +- mason/ansible/mason-setup.yml | 1 - mason/mason.sh | 4 +++- mason/share/mason.conf | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mason.configure b/mason.configure index ec8bf7d8..1198ebd0 100644 --- a/mason.configure +++ b/mason.configure @@ -130,7 +130,7 @@ yaml.dump(mason_configuration, sys.stdout, default_flow_style=False) EOF if [ "$TEST_INFRASTRUCTURE_TYPE" = "openstack" ]; then - python <<'EOF' >"$MASON_DATA/os.conf" + python <<'EOF' >>"$MASON_DATA/mason.conf" import os, sys, yaml openstack_credentials={ diff --git a/mason/ansible/mason-setup.yml b/mason/ansible/mason-setup.yml index 08490e78..d1528dbb 100644 --- a/mason/ansible/mason-setup.yml +++ b/mason/ansible/mason-setup.yml @@ -2,7 +2,6 @@ - hosts: localhost vars_files: - "/etc/mason/mason.conf" - - "/etc/mason/os.conf" tasks: diff --git a/mason/mason.sh b/mason/mason.sh index 5d27b7cf..dba99dfa 100755 --- a/mason/mason.sh +++ b/mason/mason.sh @@ -1,7 +1,9 @@ #!/bin/sh # Load OpenStack credentials -. /etc/os.conf +if [ -f "/etc/os.conf" ]; then + . /etc/os.conf +fi set -e set -x diff --git a/mason/share/mason.conf b/mason/share/mason.conf index abbf357a..1295ce84 100644 --- a/mason/share/mason.conf +++ b/mason/share/mason.conf @@ -11,4 +11,4 @@ TROVE_ID={{ TROVE_ID|quote }} BUILD_CLUSTER_MORPHOLOGY={{ MASON_CLUSTER_MORPHOLOGY|quote }} MASON_TEST_HOST={{ MASON_TEST_HOST|quote }} TEST_INFRASTRUCTURE_TYPE={{ TEST_INFRASTRUCTURE_TYPE|quote }} -OPENSTACK_NETWORK_ID={{ OPENSTACK_NETWORK_ID|quote }} +{% if OPENSTACK_NETWORK_ID is defined %}OPENSTACK_NETWORK_ID={{ OPENSTACK_NETWORK_ID|quote }}{% endif %} -- cgit v1.2.1