From 2ad25b58650b7a8d8a2d1e001cc6188b66536216 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: I2df5a50be52e39809965f8b5c0b5dcbc3ddabc86 --- defaults/main.yml | 3 +++ tasks/glance_install.yml | 16 ++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 7a929ca6..5e6fca9c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -37,6 +37,9 @@ glance_bin: "/openstack/venvs/glance-{{ glance_venv_tag }}/bin" # glance_etc_dir: "/usr/local/etc/glance" glance_etc_dir: "{{ glance_bin | dirname }}/etc/glance" +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +glance_venv_download: "{{ not glance_developer_mode | bool }}" glance_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/glance.tgz # Enable/Disable Ceilometer diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index 4ed37b6e..271a33ad 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -57,7 +57,7 @@ dest: "/var/cache/{{ glance_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', glance_venv_download_url | replace('tgz', 'checksum')) }}" register: glance_get_venv - when: not glance_developer_mode | bool + when: glance_venv_download | bool - name: Remove existing venv file: @@ -70,15 +70,14 @@ path: "{{ glance_bin | dirname }}" state: directory register: glance_venv_dir + when: glance_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ glance_venv_download_url | basename }}" dest: "{{ glance_bin | dirname }}" copy: "no" - when: - - not glance_developer_mode | bool - - glance_get_venv | changed or glance_venv_dir | changed + when: glance_get_venv | changed notify: - Restart glance services @@ -96,7 +95,7 @@ until: install_packages|success retries: 5 delay: 2 - when: glance_developer_mode | bool + when: glance_get_venv | failed or glance_get_venv | skipped notify: - Restart glance services @@ -106,12 +105,9 @@ state: "absent" when: - ansible_pkg_mgr == 'yum' - - not glance_developer_mode | bool - - glance_get_venv | changed or glance_venv_dir | changed + - glance_get_venv | changed - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ glance_bin | dirname }} - when: - - not glance_developer_mode | bool - - glance_get_venv | changed or glance_venv_dir | changed + when: glance_get_venv | changed