openqa etc: reinstall local Python libs when Python ver changes

In openqa/dispatcher, relvalconsumer and check-compose roles, we
install Python libraries from git checkouts (these are things we
don't really want to package as they change too much). This
enhances those roles so that we check whether pip considers the
libraries to be installed, and install them if it doesn't. The
purpose is to catch when the Python version rolls over on system
upgrade, and reinstall the libraries in that case - I got bitten
by this when upgrading to F32, I forgot to reinstall these libs
for Python 3.8, and it broke things for a couple of days before
I noticed and fixed it manually...

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2020-05-13 09:55:19 -07:00
parent 9e61fa2b0b
commit 2b6c8be5aa
3 changed files with 23 additions and 8 deletions

View file

@ -110,7 +110,8 @@
- name: Install required packages - name: Install required packages
package: package:
name: ['fedora-messaging', 'python3-fedfind', 'python3-openqa_client', 'python3-setuptools'] name: ['fedora-messaging', 'python3-fedfind', 'python3-openqa_client', 'python3-setuptools',
'python3-pip']
state: present state: present
tags: tags:
- packages - packages
@ -121,11 +122,18 @@
dest: /root/check-compose dest: /root/check-compose
register: gitcc register: gitcc
- name: Check if check-compose is installed for current Python
command: "pip show check_compose"
register: instcc
changed_when: "1 != 1"
failed_when: "1 != 1"
check_mode: no
- name: Install check-compose - name: Install check-compose
command: "python3 setup.py install --nodeps" command: "python3 setup.py install --nodeps"
args: args:
chdir: /root/check-compose chdir: /root/check-compose
when: "gitcc is changed" when: "gitcc is changed or instcc.rc != 0"
notify: notify:
- restart check-compose - restart check-compose

View file

@ -169,7 +169,7 @@
package: package:
name: ['fedora-messaging', 'python3-fedfind', 'python3-wikitcms', 'python3-openqa_client', name: ['fedora-messaging', 'python3-fedfind', 'python3-wikitcms', 'python3-openqa_client',
'python3-requests', 'python3-resultsdb_api', 'python3-resultsdb_conventions-fedora', 'python3-requests', 'python3-resultsdb_api', 'python3-resultsdb_conventions-fedora',
'python3-setuptools', 'python3-six'] 'python3-setuptools', 'python3-six', 'python3-pip']
state: present state: present
tags: tags:
- packages - packages
@ -204,8 +204,8 @@
register: gittools register: gittools
when: "(toolsbranch.stderr.find('Not a git repository') != -1) or (toolsbranch.stdout.find('On branch master') != -1)" when: "(toolsbranch.stderr.find('Not a git repository') != -1) or (toolsbranch.stdout.find('On branch master') != -1)"
- name: Check if fedora_openqa has ever been installed - name: Check if fedora_openqa is installed for current Python
stat: path=/usr/local/bin/fedora-openqa command: "pip show fedora_openqa"
register: insttools register: insttools
changed_when: "1 != 1" changed_when: "1 != 1"
failed_when: "1 != 1" failed_when: "1 != 1"
@ -215,7 +215,7 @@
command: "python3 setup.py install" command: "python3 setup.py install"
args: args:
chdir: /root/fedora_openqa chdir: /root/fedora_openqa
when: "gittools is changed or not insttools.stat.exists" when: "gittools is changed or insttools.rc != 0"
notify: notify:
- restart openqa consumers - restart openqa consumers

View file

@ -107,7 +107,7 @@
# 'relval' itself is needed as we call it directly for size # 'relval' itself is needed as we call it directly for size
# checking # checking
name: ['python3-fedfind', 'python3-wikitcms', 'fedora-messaging', name: ['python3-fedfind', 'python3-wikitcms', 'fedora-messaging',
'python3-mwclient', 'python3-setuptools', 'relval'] 'python3-mwclient', 'python3-pip', 'python3-setuptools', 'relval']
state: present state: present
tags: tags:
- packages - packages
@ -140,11 +140,18 @@
dest: /root/relvalconsumer dest: /root/relvalconsumer
register: gitrvc register: gitrvc
- name: Check if relvalconsumer is installed for current Python
command: "pip show relvalconsumer"
register: instrvc
changed_when: "1 != 1"
failed_when: "1 != 1"
check_mode: no
- name: Install relvalconsumer - name: Install relvalconsumer
command: "python3 setup.py install --nodeps" command: "python3 setup.py install --nodeps"
args: args:
chdir: /root/relvalconsumer chdir: /root/relvalconsumer
when: "gitrvc is changed" when: "gitrvc is changed or instrvc.rc != 0"
notify: notify:
- restart relvalconsumer - restart relvalconsumer