From c295b18a79ce8106253a3cabbbce8b430345cd71 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: I6939e47455898c07003f1b480e6d65b5d06e4c68 --- defaults/main.yml | 3 +++ tasks/rally_install.yml | 17 ++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0229fa6..4d525e9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,6 +36,9 @@ rally_developer_constraints: rally_venv_tag: untagged rally_bin: "/openstack/venvs/rally-{{ rally_venv_tag }}/bin" +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +rally_venv_download: "{{ not rally_developer_mode | bool }}" rally_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/rally.tgz # Database vars diff --git a/tasks/rally_install.yml b/tasks/rally_install.yml index ae247b3..d3c339d 100644 --- a/tasks/rally_install.yml +++ b/tasks/rally_install.yml @@ -44,7 +44,7 @@ dest: "/var/cache/{{ rally_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', rally_venv_download_url | replace('tgz', 'checksum')) }}" register: rally_get_venv - when: not rally_developer_mode | bool + when: rally_venv_download | bool - name: Remove existing venv file: @@ -56,16 +56,14 @@ file: path: "{{ rally_bin | dirname }}" state: directory - register: rally_venv_dir + when: rally_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ rally_venv_download_url | basename }}" dest: "{{ rally_bin | dirname }}" copy: "no" - when: - - not rally_developer_mode | bool - - rally_get_venv | changed or rally_venv_dir | changed + when: rally_get_venv | changed - name: Install pip packages pip: @@ -81,7 +79,7 @@ until: install_packages|success retries: 5 delay: 2 - when: rally_developer_mode | bool + when: rally_get_venv | failed or rally_get_venv | skipped - name: CentOS remove python from path first file: @@ -89,12 +87,9 @@ state: "absent" when: - ansible_pkg_mgr == 'yum' - - not rally_developer_mode | bool - - rally_get_venv | changed or rally_venv_dir | changed + - rally_get_venv | changed - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ rally_bin | dirname }} - when: - - not rally_developer_mode | bool - - rally_get_venv | changed or rally_venv_dir | changed + when: rally_get_venv | changed