From 221d46e0afb82c049041a571929faf0ea85f2ba5 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Mon, 18 May 2015 14:18:52 +0000 Subject: mason: Make some configuration parameters optional in mason.conf They are optional for deployments that use mason.configure already, but if you want to add the /etc/mason/mason.conf file post-deployment, you need the defaults to be defined in the Ansible script instead of the .configure extension. --- mason/ansible/mason-setup.yml | 35 ++++++++++++++++++++++++----------- mason/share/turbo-hipster-config.yaml | 3 +++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mason/ansible/mason-setup.yml b/mason/ansible/mason-setup.yml index 66d38d81..c1989b5e 100644 --- a/mason/ansible/mason-setup.yml +++ b/mason/ansible/mason-setup.yml @@ -13,47 +13,57 @@ - fail: msg='ARTIFACT_CACHE_SERVER is mandatory' when: ARTIFACT_CACHE_SERVER is not defined + # Gerrit settings. + # + # These are mandatory, Zuul currently cannot be used without Gerrit. + - fail: msg='GERRIT_USER is mandatory' when: GERRIT_USER is not defined - fail: msg='GERRIT_HOSTNAME is mandatory' when: GERRIT_HOSTNAME is not defined - - fail: msg='GERRIT_HTTP_PORT is mandatory' + - set_fact: GERRIT_HTTP_PORT=80 when: GERRIT_HTTP_PORT is not defined - - fail: msg='GERRIT_GIT_PORT is mandatory' + - set_fact: GERRIT_GIT_PORT=29418 when: GERRIT_GIT_PORT is not defined - fail: msg='GERRIT_SSH_KEY_PATH is mandatory' when: GERRIT_SSH_KEY_PATH is not defined - - fail: msg='GEARMAN_HOST is mandatory' + # Gearman settings: overriding these is possible in case the user wants to + # integrate this Mason with an external Gearman server, but I'm not sure why + # you'd want to do that right now. + + - set_fact: GEARMAN_HOST=localhost when: GEARMAN_HOST is not defined - - fail: msg='GEARMAN_PORT is mandatory' + - set_fact: GEARMAN_PORT=4730 when: GEARMAN_PORT is not defined - - fail: msg='START_GEARMAN is mandatory' + - set_fact: START_GEARMAN=yes when: START_GEARMAN is not defined + # Mason-specific settings + # + # These describe which Baserock systems to build and test, how to test them, + # and what to do with the resulting artifacts. + - fail: msg='MASON_CLUSTER_MORPHOLOGY is mandatory' when: MASON_CLUSTER_MORPHOLOGY is not defined - fail: msg='MASON_ARCHITECTURE is mandatory' when: MASON_ARCHITECTURE is not defined - - fail: msg='MASON_TEST_HOSTS is mandatory' - when: MASON_TEST_HOSTS is not defined - - fail: msg='MASON_DISTBUILD_CONTROLLERS is mandatory' when: MASON_DISTBUILD_CONTROLLERS is not defined - - fail: msg='MASON_TEST_INFRASTRUCTURE_TYPE is mandatory' + - set_fact: MASON_TEST_INFRASTRUCTURE_TYPE=none when: MASON_TEST_INFRASTRUCTURE_TYPE is not defined - - fail: msg='MASON_UPSTREAM_TROVE is mandatory' - when: MASON_UPSTREAM_TROVE is not defined + - fail: msg='MASON_TEST_HOSTS is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE is not "none"' + when: MASON_TEST_INFRASTRUCTURE_TYPE != "none" and MASON_TEST_HOSTS is not defined - fail: msg='OPENSTACK_NETWORK_ID is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack' when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OPENSTACK_NETWORK_ID is not defined @@ -70,6 +80,9 @@ - fail: msg='OS_AUTH_URL is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack' when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_AUTH_URL is not defined + # MASON_UPSTREAM_TROVE can also be set. If defined, built artifacts will be + # uploaded to that Trove. + - name: Create required configuration files template: src=/usr/share/mason-setup/{{ item }} dest=/etc/{{ item }} with_items: diff --git a/mason/share/turbo-hipster-config.yaml b/mason/share/turbo-hipster-config.yaml index 8ae8133d..6df21bc2 100644 --- a/mason/share/turbo-hipster-config.yaml +++ b/mason/share/turbo-hipster-config.yaml @@ -30,6 +30,8 @@ plugins: deployment-host: [ "{{ MASON_TEST_HOSTS }}" ] trove-id: "{{ TROVE_ID }}" openstack-network-id: "{{ OPENSTACK_NETWORK_ID }}" + +{%if MASON_UPSTREAM_TROVE is defined %} - name: artifact-upload function: build:artifact_upload import-path: mason.tests.artifact_upload @@ -40,6 +42,7 @@ plugins: architecture: "{{ MASON_ARCHITECTURE }}" upstream-trove: "{{ MASON_UPSTREAM_TROVE }}" upload-release-artifacts: False +{% endif %} publish_logs: type: local -- cgit v1.2.1