Skip to content

Commit

Permalink
Merge "Re-deploy the Aodh venv if it mismatches the repo"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 29, 2016
2 parents dda9ff2 + 81be611 commit 2d766bc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions playbooks/roles/os_aodh/defaults/main.yml
Expand Up @@ -91,6 +91,7 @@ aodh_requires_pip_packages:
- virtualenv
- virtualenv-tools
- python-keystoneclient # Keystoneclient needed to OSA keystone lib
- httplib2

# Common pip packages
aodh_pip_packages:
Expand Down
49 changes: 46 additions & 3 deletions playbooks/roles/os_aodh/tasks/aodh_install.yml
Expand Up @@ -42,13 +42,42 @@
- aodh-install
- aodh-pip-packages

- name: Get local venv checksum
stat:
path: "/var/cache/{{ aodh_venv_download_url | basename }}"
get_md5: False
when: aodh_venv_enabled | bool
register: local_venv_stat
tags:
- aodh-install
- aodh-pip-packages

- name: Get remote venv checksum
uri:
url: "{{ aodh_venv_download_url | replace('tgz', 'checksum') }}"
return_content: True
when: aodh_venv_enabled | bool
register: remote_venv_checksum
tags:
- aodh-install
- aodh-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
get_url:
url: "{{ aodh_venv_download_url }}"
dest: "/var/cache/{{ aodh_venv_download_url | basename }}"
force: yes
ignore_errors: true
register: get_venv
when: aodh_venv_enabled | bool
when:
- aodh_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:
- aodh-install
- aodh-pip-packages
Expand All @@ -61,13 +90,24 @@
- aodh-install
- aodh-pip-packages

- name: Remove existing venv
file:
path: "{{ aodh_venv_bin | dirname }}"
state: absent
when:
- aodh_venv_enabled | bool
- aodh_get_venv | changed
tags:
- aodh-install
- aodh-pip-packages

- name: Create aodh venv dir
file:
path: "{{ aodh_venv_bin | dirname }}"
state: directory
when:
- aodh_venv_enabled | bool
- aodh_get_venv | success
- aodh_get_venv | changed
tags:
- aodh-install
- aodh-pip-packages
Expand All @@ -79,7 +119,8 @@
copy: "no"
when:
- aodh_venv_enabled | bool
- aodh_get_venv | success
- aodh_get_venv | changed
notify: Restart aodh services
tags:
- aodh-install
- aodh-pip-packages
Expand Down Expand Up @@ -109,6 +150,7 @@
when:
- aodh_venv_enabled | bool
- aodh_get_venv | failed
notify: Restart aodh services
tags:
- aodh-install
- aodh-pip-packages
Expand All @@ -124,6 +166,7 @@
delay: 2
with_items: aodh_pip_packages
when: not aodh_venv_enabled | bool
notify: Restart aodh services
tags:
- aodh-install
- aodh-pip-packages

0 comments on commit 2d766bc

Please sign in to comment.