Switching local gating scripts to Python3 to comply with Zuul

The initial version of gating playbook contained ability
to run them either on Python2 or Python3 ansible.
But it causes a lot of issues e.g. a need to install[1] both
versions of libs to support both possible ways to run,
discrepancy between local and Zuul run[2]
Zuul testing is done with ansible running on Python3 [3].
Meanwhile ppa repo for ansible contains ansible pachage
that depends only from python2. There is no package for
Python3 and we used only Python2-ansyble.
The fact that Zuul runs it with different configuration
means that we'll keep facing the issues with dependencies
in future, since Gating doesn't test it.
This patch changes makes local scripts run as Zuul.

PS
The script partially takes care of reverting intallation
from its previous runs. To cleanup completely it's possible
to run [4] in case these pacakges are not used by anyone else

[1]
https://opendev.org/airship/airshipctl/src/branch/master/roles/libvirt-install/tasks/main.yaml#L38
[2]
https://review.opendev.org/#/c/717841/
https://review.opendev.org/#/c/718590/
[3]
https://zuul.opendev.org/t/openstack/build/4096513604a84cd2b2f2578fc3f98660/log/zuul-info/host-info.primary.yaml#498
[4]
if dpkg -l | grep "ansible.*ppa~bionic"; then
      sudo apt -y remove ansible
      sudo apt -y autoremove
      sudo add-apt-repository -r -y ppa:ansible/ansible
      sudo apt-get -y update
fi
+ possibly
sudo apt remove virtinst python-libvirt python-docker python-requests python-lxml python-libvirt

Change-Id: Ia1ac3aa4128f6c4797dea1709ccb8516ae342a66
This commit is contained in:
Alexey Odinokov 2020-04-11 03:56:05 +00:00
parent 788dc35b0a
commit 1505353333
5 changed files with 5 additions and 14 deletions

View File

@ -10,12 +10,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install python-docker Module
- name: Install python3-docker and python3-requests Modules
apt:
pkg:
- python-docker
- python3-docker
- python-requests
- python3-requests
state: present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

View File

@ -22,7 +22,6 @@
- libvirt-devel
- libvirt-daemon-kvm
- qemu-kvm
- virt-install
state: present
- name: Ensuring Libvirt, Qemu and support packages are present
become: true
@ -33,11 +32,8 @@
- libvirt-bin
- libguestfs-tools
- qemu-kvm
- virtinst
- python-lxml
- python3-lxml
- python3-libvirt
- python-libvirt
- dnsmasq
- ebtables
state: present

View File

@ -23,7 +23,6 @@
name:
- python3-pip
- python3-libvirt
- python-libvirt
state: present
- name: Install sushy-tools

View File

@ -11,7 +11,6 @@
name:
- python3-pip
- python3-libvirt
- python-libvirt
state: present
- name: Install required pip packages

View File

@ -32,10 +32,9 @@ mkdir -p "$TMP_DIR"
envsubst <"${AIRSHIPCTL_WS}/tools/gate/config_template.yaml" > "$PLAYBOOK_CONFIG"
# use new version of ansible, Ubuntu has old one
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get -y update
sudo apt-get -y --no-install-recommends install docker.io ansible make python-passlib
sudo apt install software-properties-common python3-pip
sudo apt-get -y --no-install-recommends install docker.io make
sudo pip3 install ansible
echo "primary ansible_host=localhost ansible_connection=local" > "$ANSIBLE_HOSTS"
echo "primary ansible_host=localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3" > "$ANSIBLE_HOSTS"
printf "[defaults]\nroles_path = %s/roles\n" "$AIRSHIPCTL_WS" > "$ANSIBLE_CFG"