From c7539bdc98bd2bbf0fbc8ff1b61dcd7d1662b6b3 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: Iea13582d7344e343f60439500ef5e38dfbf1f1c1 --- defaults/main.yml | 3 +++ tasks/horizon_install.yml | 19 ++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 16e21de5..d5031126 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -51,6 +51,9 @@ horizon_developer_constraints: horizon_venv_tag: untagged horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin" +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +horizon_venv_download: "{{ not horizon_developer_mode | bool }}" horizon_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/horizon.tgz ## System info diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index 78c8cef8..04685831 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -81,7 +81,7 @@ dest: "/var/cache/{{ horizon_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', horizon_venv_download_url | replace('tgz', 'checksum')) }}" register: horizon_get_venv - when: not horizon_developer_mode | bool + when: horizon_venv_download | bool - name: Remove existing venv file: @@ -95,18 +95,14 @@ state: directory mode: "0755" register: horizon_venv_dir - when: - - not horizon_developer_mode | bool - - horizon_get_venv | changed + when: horizon_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ horizon_venv_download_url | basename }}" dest: "{{ horizon_bin | dirname }}" copy: "no" - when: - - not horizon_developer_mode | bool - - horizon_get_venv | changed or horizon_venv_dir | changed + when: horizon_get_venv | changed notify: Restart apache2 - name: Install pip packages @@ -123,7 +119,7 @@ until: install_packages|success retries: 5 delay: 2 - when: horizon_developer_mode | bool + when: horizon_get_venv | failed or horizon_get_venv | skipped notify: Restart apache2 - name: Install optional pip packages @@ -148,15 +144,12 @@ state: "absent" when: - ansible_pkg_mgr == 'yum' - - not horizon_developer_mode | bool - - horizon_get_venv | changed or horizon_venv_dir | changed + - horizon_get_venv | changed - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ horizon_bin | dirname }} - when: - - not horizon_developer_mode | bool - - horizon_get_venv | changed or horizon_venv_dir | changed + when: horizon_get_venv | changed - name: Create horizon link for venv file: