diff --git a/defaults/main.yml b/defaults/main.yml index 0f79751a..e0f470f0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,15 +46,7 @@ magnum_api_paste_ini_overrides: {} # Name of the virtual env to deploy into magnum_venv_tag: untagged -magnum_venv_bin: "/openstack/venvs/magnum-{{ magnum_venv_tag }}/bin" - -# Set this to enable or disable installing in a venv -magnum_venv_enabled: true - -# The bin path defaults to the venv path however if installation in a -# venv is disabled the bin path will be dynamically set based on the -# system path used when the installing. -magnum_bin: "{{ magnum_venv_bin }}" +magnum_bin: "/openstack/venvs/magnum-{{ magnum_venv_tag }}/bin" magnum_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/magnum.tgz diff --git a/releasenotes/notes/os_magnum-install-venv-30263e29e51a2610.yaml b/releasenotes/notes/os_magnum-install-venv-30263e29e51a2610.yaml new file mode 100644 index 00000000..ba2f0216 --- /dev/null +++ b/releasenotes/notes/os_magnum-install-venv-30263e29e51a2610.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - Installation of magnum and its dependent pip packages will now only + occur within a Python virtual environment. The ``magnum_venv_bin``, + ``magnum_venv_enabled`` variables have been removed. diff --git a/tasks/database-setup.yml b/tasks/database-setup.yml index 2dc62808..f1eb30ba 100644 --- a/tasks/database-setup.yml +++ b/tasks/database-setup.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Perform a synchronization of the Magnum database - command: "{{ magnum_venv_bin}}/magnum-db-manage upgrade" + command: "{{ magnum_bin}}/magnum-db-manage upgrade" become: yes become_user: "{{ magnum_system_user_name }}" tags: diff --git a/tasks/install.yml b/tasks/install.yml index 356a33ee..eb8a235e 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -84,7 +84,6 @@ get_md5: False when: - not magnum_developer_mode | bool - - magnum_venv_enabled | bool register: local_venv_stat tags: - magnum-install @@ -96,7 +95,6 @@ return_content: True when: - not magnum_developer_mode | bool - - magnum_venv_enabled | bool register: remote_venv_checksum tags: - magnum-install @@ -116,7 +114,6 @@ register: get_venv when: - not magnum_developer_mode | bool - - magnum_venv_enabled | bool - (local_venv_stat.stat.exists == False or {{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }}) tags: @@ -126,17 +123,15 @@ - name: Set magnum get_venv fact set_fact: magnum_get_venv: "{{ get_venv }}" - when: magnum_venv_enabled | bool tags: - magnum-install - magnum-pip-packages - name: Remove existing venv file: - path: "{{ magnum_venv_bin | dirname }}" + path: "{{ magnum_bin | dirname }}" state: absent when: - - magnum_venv_enabled | bool - magnum_get_venv | changed tags: - magnum-install @@ -144,12 +139,9 @@ - name: Create magnum venv dir file: - path: "{{ magnum_venv_bin | dirname }}" + path: "{{ magnum_bin | dirname }}" state: directory - when: - - not magnum_developer_mode | bool - - magnum_venv_enabled | bool - - magnum_get_venv | changed + register: magnum_venv_dir tags: - magnum-install - magnum-pip-packages @@ -157,33 +149,21 @@ - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ magnum_venv_download_url | basename }}" - dest: "{{ magnum_venv_bin | dirname }}" + dest: "{{ magnum_bin | dirname }}" copy: "no" when: - not magnum_developer_mode | bool - - magnum_venv_enabled | bool - - magnum_get_venv | changed + - magnum_get_venv | changed or magnum_venv_dir | changed notify: Restart magnum services tags: - magnum-install - magnum-pip-packages -- name: Update virtualenv path - command: > - virtualenv-tools --update-path=auto {{ magnum_venv_bin | dirname }} - when: - - not magnum_developer_mode | bool - - magnum_venv_enabled | bool - - magnum_get_venv | success - tags: - - magnum-install - - magnum-pip-packages - -- name: Install pip packages (venv) +- name: Install pip packages pip: name: "{{ item }}" state: latest - virtualenv: "{{ magnum_venv_bin | dirname }}" + virtualenv: "{{ magnum_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact }}" register: install_packages @@ -192,27 +172,19 @@ delay: 2 with_items: "{{ magnum_pip_packages }}" when: - - magnum_venv_enabled | bool - magnum_get_venv | failed or magnum_developer_mode | bool notify: Restart magnum services tags: - magnum-install - magnum-pip-packages -- name: Install pip packages (no venv) - pip: - name: "{{ item }}" - state: latest - extra_args: "{{ pip_install_options_fact }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: "{{ magnum_pip_packages }}" +- name: Update virtualenv path + command: > + virtualenv-tools --update-path=auto {{ magnum_bin | dirname }} when: - not magnum_developer_mode | bool - - not magnum_venv_enabled | bool - notify: Restart magnum services + - magnum_get_venv | success tags: - magnum-install - magnum-pip-packages + diff --git a/templates/upstart-init.j2 b/templates/upstart-init.j2 index a310d56a..d8347a8f 100644 --- a/templates/upstart-init.j2 +++ b/templates/upstart-init.j2 @@ -23,9 +23,7 @@ pre-start script mkdir -p "/var/lock/{{ program_name }}" chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}" - {% if magnum_venv_enabled | bool -%} - . {{ magnum_venv_bin }}/activate - {%- endif %} + . {{ magnum_bin }}/activate end script