From c2f3c075af59296601474d20207ca8a8f07ffc2a Mon Sep 17 00:00:00 2001 From: Logan V Date: Fri, 13 Jan 2017 19:52:41 -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: I0280dce05e9f20b035e64b85750c72895e83a4b7 --- defaults/main.yml | 3 +++ tasks/install.yml | 13 +++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6e547df..23552db 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -51,6 +51,9 @@ monasca_service_adminurl: "{{ monasca_service_adminuri_proto }}://{{ internal_lb # Name of the virtual env to deploy into monasca_venv_tag: untagged +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +monasca_venv_download: "{{ not monasca_developer_mode | bool }}" monasca_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/monasca.tgz monasca_bin: "/openstack/venvs/monasca-{{ monasca_venv_tag }}/bin" diff --git a/tasks/install.yml b/tasks/install.yml index 88e2419..df4e87c 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -47,7 +47,7 @@ dest: "/var/cache/{{ monasca_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', monasca_venv_download_url | replace('tgz', 'checksum')) }}" register: monasca_get_venv - when: not monasca_developer_mode | bool + when: monasca_venv_download | bool - name: Remove existing venv file: @@ -60,15 +60,14 @@ path: "{{ monasca_bin | dirname }}" state: directory register: monasca_venv_dir + when: monasca_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ monasca_venv_download_url | basename }}" dest: "{{ monasca_bin | dirname }}" copy: "no" - when: - - not monasca_developer_mode | bool - - monasca_get_venv | changed or monasca_venv_dir | changed + when: monasca_get_venv | changed notify: - Restart monasca services @@ -86,12 +85,10 @@ until: install_packages|success retries: 5 delay: 2 - when: monasca_developer_mode | bool + when: monasca_get_venv | failed or monasca_get_venv | skipped notify: Restart monasca services - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ monasca_bin | dirname }} - when: - - not monasca_developer_mode | bool - - monasca_get_venv | changed or monasca_venv_dir | changed + when: monasca_get_venv | changed