diff --git a/defaults/main.yml b/defaults/main.yml index b6f55f5..67bb876 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,24 +23,10 @@ sahara_developer_constraints: - "git+{{ sahara_git_repo }}@{{ sahara_git_install_branch }}#egg=sahara" # Name of the virtual env to deploy into -sahara_venv_tag: untagged -sahara_venv_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin" +sahara_venv_tag: untagged +sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin" -# Set this to enable or disable installing in a venv -sahara_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. -sahara_bin: "{{ sahara_venv_bin }}" - -# Set the etc dir path where sahara is installed. -# This is used for role access to the db migrations. -# Example: -# sahara_etc_dir: "/usr/local/etc/sahara" -sahara_venv_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara" -sahara_non_venv_etc_dir: "/usr/local/etc/sahara" -sahara_etc_dir: "{{ (sahara_venv_enabled | bool) | ternary(sahara_venv_etc_dir, sahara_non_venv_etc_dir) }}" +sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara" sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz diff --git a/releasenotes/notes/os_sahara-only-install-venv-8ead48687897ce0b.yaml b/releasenotes/notes/os_sahara-only-install-venv-8ead48687897ce0b.yaml new file mode 100644 index 0000000..c002b78 --- /dev/null +++ b/releasenotes/notes/os_sahara-only-install-venv-8ead48687897ce0b.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - Installation of sahara and its dependent pip packages will now only + occur within a Python virtual environment. The ``sahara_venv_bin``, + ``sahara_venv_enabled``, ``sahara_venv_etc_dir``, and + ``sahara_non_venv_etc_dir`` variables have been removed. diff --git a/tasks/sahara_install.yml b/tasks/sahara_install.yml index ec3393c..232e0fb 100644 --- a/tasks/sahara_install.yml +++ b/tasks/sahara_install.yml @@ -82,7 +82,6 @@ get_md5: False when: - not sahara_developer_mode | bool - - sahara_venv_enabled | bool register: local_venv_stat tags: - sahara-install @@ -94,7 +93,6 @@ return_content: True when: - not sahara_developer_mode | bool - - sahara_venv_enabled | bool register: remote_venv_checksum tags: - sahara-install @@ -114,7 +112,6 @@ register: get_venv when: - not sahara_developer_mode | bool - - sahara_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: @@ -124,17 +121,15 @@ - name: Set sahara get_venv fact set_fact: sahara_get_venv: "{{ get_venv }}" - when: sahara_venv_enabled | bool tags: - sahara-install - sahara-pip-packages - name: Remove existing venv file: - path: "{{ sahara_venv_bin | dirname }}" + path: "{{ sahara_bin | dirname }}" state: absent when: - - sahara_venv_enabled | bool - sahara_get_venv | changed tags: - sahara-install @@ -142,12 +137,9 @@ - name: Create sahara venv dir file: - path: "{{ sahara_venv_bin | dirname }}" + path: "{{ sahara_bin | dirname }}" state: directory - when: - - not sahara_developer_mode | bool - - sahara_venv_enabled | bool - - sahara_get_venv | changed + register: sahara_venv_dir tags: - sahara-install - sahara-pip-packages @@ -155,34 +147,22 @@ - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ sahara_venv_download_url | basename }}" - dest: "{{ sahara_venv_bin | dirname }}" + dest: "{{ sahara_bin | dirname }}" copy: "no" when: - not sahara_developer_mode | bool - - sahara_venv_enabled | bool - - sahara_get_venv | changed + - sahara_get_venv | changed or sahara_venv_dir | changed notify: - Restart sahara services tags: - sahara-install - sahara-pip-packages -- name: Update virtualenv path - command: > - virtualenv-tools --update-path=auto {{ sahara_venv_bin | dirname }} - when: - - not sahara_developer_mode | bool - - sahara_venv_enabled | bool - - sahara_get_venv | success - tags: - - sahara-install - - sahara-pip-packages - - name: Install pip packages (venv) pip: name: "{{ item }}" state: present - virtualenv: "{{ sahara_venv_bin | dirname }}" + virtualenv: "{{ sahara_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact }}" register: install_packages @@ -191,7 +171,6 @@ delay: 2 with_items: "{{ sahara_pip_packages }}" when: - - sahara_venv_enabled | bool - sahara_get_venv | failed or sahara_developer_mode | bool notify: - Restart sahara services @@ -199,21 +178,13 @@ - sahara-install - sahara-pip-packages -- name: Install pip packages (no venv) - pip: - name: "{{ item }}" - state: present - extra_args: "{{ pip_install_options_fact }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: "{{ sahara_pip_packages }}" +- name: Update virtualenv path + command: > + virtualenv-tools --update-path=auto {{ sahara_bin | dirname }} when: - - not sahara_venv_enabled | bool - not sahara_developer_mode | bool - notify: - - Restart sahara services + - sahara_get_venv | success tags: - sahara-install - sahara-pip-packages + diff --git a/tasks/sahara_post_install.yml b/tasks/sahara_post_install.yml index 2546484..3b4298c 100644 --- a/tasks/sahara_post_install.yml +++ b/tasks/sahara_post_install.yml @@ -39,18 +39,3 @@ tags: - sahara-config -- name: Get sahara command path - command: which sahara - register: sahara_command_path - when: - - not sahara_venv_enabled | bool - tags: - - sahara-command-bin - -- name: Set sahara command path - set_fact: - sahara_bin: "{{ sahara_command_path.stdout | dirname }}" - when: - - not sahara_venv_enabled | bool - tags: - - sahara-command-bin diff --git a/tasks/sahara_pre_install.yml b/tasks/sahara_pre_install.yml index fe692ec..eb21208 100644 --- a/tasks/sahara_pre_install.yml +++ b/tasks/sahara_pre_install.yml @@ -46,17 +46,6 @@ tags: - sahara-dirs -- name: Create sahara venv dir - file: - path: "{{ item.path }}" - state: directory - with_items: - - { path: "/openstack/venvs" } - - { path: "{{ sahara_venv_bin }}" } - when: sahara_venv_enabled | bool - tags: - - sahara-dirs - - name: Test for log directory or link shell: | if [ -h "/var/log/sahara" ]; then diff --git a/templates/sahara-upstart-init.j2 b/templates/sahara-upstart-init.j2 index d9c079c..d8869f3 100644 --- a/templates/sahara-upstart-init.j2 +++ b/templates/sahara-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 sahara_venv_enabled | bool -%} - . {{ sahara_venv_bin }}/activate - {%- endif %} + . {{ sahara_bin }}/activate end script diff --git a/tests/test-vars.yml b/tests/test-vars.yml index dfa0f80..951ff67 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -102,7 +102,7 @@ sahara_container_mysql_password: "SuperSecrete" sahara_rabbitmq_password: "secrete" sahara_rabbitmq_userid: sahara sahara_rabbitmq_vhost: /sahara -sahara_venv_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin" +sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin" tempest_developer_mode: True tempest_git_install_branch: master tempest_venv_tag: "{{ tempest_git_install_branch }}"