diff --git a/defaults/main.yml b/defaults/main.yml index 96fbe3b1..dd4c3eba 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -27,23 +27,13 @@ glance_developer_constraints: # Name of the virtual env to deploy into glance_venv_tag: untagged -glance_venv_bin: "/openstack/venvs/glance-{{ glance_venv_tag }}/bin" - -# Set this to enable or disable installing in a venv -glance_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. -glance_bin: "{{ glance_venv_bin }}" +glance_bin: "/openstack/venvs/glance-{{ glance_venv_tag }}/bin" # Set the etc dir path where glance is installed. # This is used for role access to the db migrations. # Example: # glance_etc_dir: "/usr/local/etc/glance" -glance_venv_etc_dir: "{{ glance_bin | dirname }}/etc/glance" -glance_non_venv_etc_dir: "/usr/local/etc/glance" -glance_etc_dir: "{{ (glance_venv_enabled | bool) | ternary(glance_venv_etc_dir, glance_non_venv_etc_dir) }}" +glance_etc_dir: "{{ glance_bin | dirname }}/etc/glance" glance_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/glance.tgz diff --git a/releasenotes/notes/os-glance-only-install-venv-0271d3238c0d561c.yaml b/releasenotes/notes/os-glance-only-install-venv-0271d3238c0d561c.yaml new file mode 100644 index 00000000..afa6dbf5 --- /dev/null +++ b/releasenotes/notes/os-glance-only-install-venv-0271d3238c0d561c.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - Installation of glance and its dependent pip packages will now only + occur within a Python virtual environment. The ``glance_venv_bin``, + ``glance_venv_enabled``, ``glance_venv_etc_dir``, and + ``glance_non_venv_etc_dir`` variables have been removed. diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index 46636229..0a226953 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -85,7 +85,6 @@ get_md5: False when: - not glance_developer_mode | bool - - glance_venv_enabled | bool register: local_venv_stat tags: - glance-install @@ -97,7 +96,6 @@ return_content: True when: - not glance_developer_mode | bool - - glance_venv_enabled | bool register: remote_venv_checksum tags: - glance-install @@ -117,7 +115,6 @@ register: get_venv when: - not glance_developer_mode | bool - - glance_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: @@ -127,17 +124,15 @@ - name: Set glance get_venv fact set_fact: glance_get_venv: "{{ get_venv }}" - when: glance_venv_enabled | bool tags: - glance-install - glance-pip-packages - name: Remove existing venv file: - path: "{{ glance_venv_bin | dirname }}" + path: "{{ glance_bin | dirname }}" state: absent when: - - glance_venv_enabled | bool - glance_get_venv | changed tags: - glance-install @@ -145,12 +140,9 @@ - name: Create glance venv dir file: - path: "{{ glance_venv_bin | dirname }}" + path: "{{ glance_bin | dirname }}" state: directory - when: - - not glance_developer_mode | bool - - glance_venv_enabled | bool - - glance_get_venv | changed + register: glance_venv_dir tags: - glance-install - glance-pip-packages @@ -158,34 +150,22 @@ - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ glance_venv_download_url | basename }}" - dest: "{{ glance_venv_bin | dirname }}" + dest: "{{ glance_bin | dirname }}" copy: "no" when: - not glance_developer_mode | bool - - glance_venv_enabled | bool - - glance_get_venv | changed + - glance_get_venv | changed or glance_venv_dir | changed notify: - Restart glance services tags: - glance-install - glance-pip-packages -- name: Update virtualenv path - command: > - virtualenv-tools --update-path=auto {{ glance_venv_bin | dirname }} - when: - - not glance_developer_mode | bool - - glance_venv_enabled | bool - - glance_get_venv | success - tags: - - glance-install - - glance-pip-packages - -- name: Install pip packages (venv) +- name: Install pip packages pip: name: "{{ item }}" state: latest - virtualenv: "{{ glance_venv_bin | dirname }}" + virtualenv: "{{ glance_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact }}" register: install_packages @@ -194,7 +174,6 @@ delay: 2 with_items: "{{ glance_pip_packages }}" when: - - glance_venv_enabled | bool - glance_get_venv | failed or glance_developer_mode | bool notify: - Restart glance services @@ -202,21 +181,10 @@ - glance-install - glance-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: "{{ glance_pip_packages }}" - when: - - not glance_venv_enabled | bool - - not glance_developer_mode | bool - notify: - - Restart glance services +- name: Update virtualenv path + command: > + virtualenv-tools --update-path=auto {{ glance_bin | dirname }} tags: - glance-install - glance-pip-packages + diff --git a/tasks/glance_post_install.yml b/tasks/glance_post_install.yml index 12e10fb9..b6a580cf 100644 --- a/tasks/glance_post_install.yml +++ b/tasks/glance_post_install.yml @@ -94,22 +94,6 @@ - glance-nfs - glance-nfs-local-path -- name: Get glance command path - command: which glance - register: glance_command_path - when: - - not glance_venv_enabled | bool - tags: - - glance-command-bin - -- name: Set glance command path - set_fact: - glance_bin: "{{ glance_command_path.stdout | dirname }}" - when: - - not glance_venv_enabled | bool - tags: - - glance-command-bin - - name: Create glance cache management cron jobs cron: name: "{{ item.name }}" diff --git a/tasks/glance_pre_install.yml b/tasks/glance_pre_install.yml index 2259c952..e93b003b 100644 --- a/tasks/glance_pre_install.yml +++ b/tasks/glance_pre_install.yml @@ -52,17 +52,6 @@ tags: - glance-dirs -- name: Create glance venv dir - file: - path: "{{ item.path }}" - state: directory - with_items: - - { path: "/openstack/venvs" } - - { path: "{{ glance_venv_bin }}" } - when: glance_venv_enabled | bool - tags: - - glance-dirs - - name: Test for log directory or link shell: | if [ -h "/var/log/glance" ]; then diff --git a/templates/glance-upstart-init.j2 b/templates/glance-upstart-init.j2 index 042da6a4..d03aa1f1 100644 --- a/templates/glance-upstart-init.j2 +++ b/templates/glance-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 glance_venv_enabled | bool -%} - . {{ glance_venv_bin }}/activate - {%- endif %} + . {{ glance_bin }}/activate end script