From c8363e45ab954cf7f652b3c2f3c262bd5946bbc9 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: Ie16f861b9abdc5887365bb58c9eec427f55cb177 --- defaults/main.yml | 3 +++ tasks/ironic_install.yml | 16 ++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 1e55c053..bf52f4ad 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -142,6 +142,9 @@ ironic_node_name: ironic # regenerated each run. ironic_recreate_keys: False +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +ironic_venv_download: "{{ not ironic_developer_mode | bool }}" ironic_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/ironic.tgz ironic_tftp_server_address: "{{ ansible_host }}" diff --git a/tasks/ironic_install.yml b/tasks/ironic_install.yml index ceee8258..09f03f56 100644 --- a/tasks/ironic_install.yml +++ b/tasks/ironic_install.yml @@ -48,7 +48,7 @@ dest: "/var/cache/{{ ironic_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', ironic_venv_download_url | replace('tgz', 'checksum')) }}" register: ironic_get_venv - when: not ironic_developer_mode | bool + when: ironic_venv_download | bool - name: Remove existing venv file: @@ -61,15 +61,14 @@ path: "{{ ironic_bin | dirname }}" state: directory register: ironic_venv_dir + when: ironic_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ ironic_venv_download_url | basename }}" dest: "{{ ironic_bin | dirname }}" copy: "no" - when: - - not ironic_developer_mode | bool - - ironic_get_venv | changed or ironic_venv_dir | changed + when: ironic_get_venv | changed notify: Restart ironic services - name: Install pip packages @@ -86,7 +85,7 @@ until: install_packages|success retries: 5 delay: 2 - when: ironic_developer_mode | bool + when: ironic_get_venv | failed or ironic_get_venv | skipped notify: Restart ironic services - name: CentOS remove python from path first @@ -95,12 +94,9 @@ state: "absent" when: - ansible_pkg_mgr == 'yum' - - not ironic_developer_mode | bool - - ironic_get_venv | changed or ironic_venv_dir | changed + - ironic_get_venv | changed - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ ironic_bin | dirname }} - when: - - not ironic_developer_mode | bool - - ironic_get_venv | changed or ironic_venv_dir | changed + when: ironic_get_venv | changed