Merge "Re-deploy the Neutron venv if it mismatches the repo"

This commit is contained in:
Jenkins 2016-01-29 03:00:37 +00:00 committed by Gerrit Code Review
commit f12e6d9c9a
2 changed files with 47 additions and 3 deletions

View File

@ -328,6 +328,7 @@ neutron_requires_pip_packages:
- virtualenv - virtualenv
- virtualenv-tools - virtualenv-tools
- python-keystoneclient # Keystoneclient needed to OSA keystone lib - python-keystoneclient # Keystoneclient needed to OSA keystone lib
- httplib2
neutron_pip_packages: neutron_pip_packages:
- configobj - configobj

View File

@ -80,13 +80,42 @@
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages
- name: Get local venv checksum
stat:
path: "/var/cache/{{ neutron_venv_download_url | basename }}"
get_md5: False
when: neutron_venv_enabled | bool
register: local_venv_stat
tags:
- neutron-install
- neutron-pip-packages
- name: Get remote venv checksum
uri:
url: "{{ neutron_venv_download_url | replace('tgz', 'checksum') }}"
return_content: True
when: neutron_venv_enabled | bool
register: remote_venv_checksum
tags:
- neutron-install
- neutron-pip-packages
# TODO: When project moves to ansible 2 we can pass this a sha256sum which will:
# a) allow us to remove force: yes
# b) allow the module to calculate the checksum of dest file which would
# result in file being downloaded only if provided and dest sha256sum
# checksums differ
- name: Attempt venv download - name: Attempt venv download
get_url: get_url:
url: "{{ neutron_venv_download_url }}" url: "{{ neutron_venv_download_url }}"
dest: "/var/cache/{{ neutron_venv_download_url | basename }}" dest: "/var/cache/{{ neutron_venv_download_url | basename }}"
force: yes
ignore_errors: true ignore_errors: true
register: get_venv register: get_venv
when: neutron_venv_enabled | bool when:
- neutron_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: tags:
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages
@ -99,13 +128,24 @@
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages
- name: Remove existing venv
file:
path: "{{ neutron_venv_bin | dirname }}"
state: absent
when:
- neutron_venv_enabled | bool
- neutron_get_venv | changed
tags:
- neutron-install
- neutron-pip-packages
- name: Create neutron venv dir - name: Create neutron venv dir
file: file:
path: "{{ neutron_venv_bin | dirname }}" path: "{{ neutron_venv_bin | dirname }}"
state: directory state: directory
when: when:
- neutron_venv_enabled | bool - neutron_venv_enabled | bool
- neutron_get_venv | success - neutron_get_venv | changed
tags: tags:
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages
@ -117,7 +157,8 @@
copy: "no" copy: "no"
when: when:
- neutron_venv_enabled | bool - neutron_venv_enabled | bool
- neutron_get_venv | success - neutron_get_venv | changed
notify: Restart neutron services
tags: tags:
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages
@ -147,6 +188,7 @@
when: when:
- neutron_venv_enabled | bool - neutron_venv_enabled | bool
- neutron_get_venv | failed - neutron_get_venv | failed
notify: Restart neutron services
tags: tags:
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages
@ -162,6 +204,7 @@
delay: 2 delay: 2
with_items: neutron_pip_packages with_items: neutron_pip_packages
when: not neutron_venv_enabled | bool when: not neutron_venv_enabled | bool
notify: Restart neutron services
tags: tags:
- neutron-install - neutron-install
- neutron-pip-packages - neutron-pip-packages