From 8aa416f385f387eacf6dc34665aa0197bcd6f2f2 Mon Sep 17 00:00:00 2001 From: Logan V Date: Fri, 13 Jan 2017 19:52:42 -0600 Subject: [PATCH] Clean up developer mode logic Fixes the ability to deploy a venv in cases where: 1) developer_mode is not enabled 2) A cached venv is not downloaded from the repo server Additional cleanup to the developer_mode venv deployment logic is implemented by adding a *_venv_download var which is used to decouple developer_mode from the cached venv extraction process so that a deployer can force venv builds in-place (disable cached venv usage) without enabling developer mode constraints. Change-Id: Id4e911dd28bf3e22fe5927b06464ee15c57f010e --- defaults/main.yml | 3 +++ tasks/trove_install.yml | 13 +++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 74ef329..fe25e35 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -68,6 +68,9 @@ trove_profiler_enabled: false trove_venv_tag: untagged trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin" +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +trove_venv_download: "{{ not trove_developer_mode | bool }}" trove_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/trove.tgz trove_git_repo: "https://git.openstack.org/openstack/trove" diff --git a/tasks/trove_install.yml b/tasks/trove_install.yml index 0d9436b..325840a 100644 --- a/tasks/trove_install.yml +++ b/tasks/trove_install.yml @@ -61,7 +61,7 @@ dest: "/var/cache/{{ trove_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', trove_venv_download_url | replace('tgz', 'checksum')) }}" register: trove_get_venv - when: not trove_developer_mode | bool + when: trove_venv_download | bool - name: Remove existing venv file: @@ -75,15 +75,14 @@ state: directory mode: "0755" register: trove_venv_dir + when: trove_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ trove_venv_download_url | basename }}" dest: "{{ trove_bin | dirname }}" copy: "no" - when: - - not trove_developer_mode | bool - - trove_get_venv | changed or trove_venv_dir | changed + when: trove_get_venv | changed notify: - Restart trove API services - Restart trove conductor service @@ -104,7 +103,7 @@ until: install_packages|success retries: 5 delay: 2 - when: trove_developer_mode | bool + when: trove_get_venv | failed or trove_get_venv | skipped notify: - Restart trove API services - Restart trove conductor service @@ -114,6 +113,4 @@ - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ trove_bin | dirname }} - when: - - not trove_developer_mode | bool - - trove_get_venv | changed or trove_venv_dir | changed + when: trove_get_venv | changed