Skip to content

update marvin to ol9 #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 21 additions & 49 deletions Ansible/roles/marvin/tasks/install_marvin_prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,26 @@
- marvin_cfg
- marvin_install

- include: ../../../tasks/set_centos_repos.yml
tags:
- marvin
- marvin_install

- name: Install Dev Tools Group
yum: name="@Development tools" state=installed update_cache=yes
dnf: name="@Development tools" state=installed
tags:
- marvin
- marvin_cfg
- marvin_install

- name: Install other dependancies
yum: name={{ item }} state=installed update_cache=yes
dnf: name={{ item }} state=installed
with_items:
- 'http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm'
- zlib-devel
- bzip2-devel
- openssl-devel
- xz-libs
- wget
- sqlite
- sqlite-devel
- python-paramiko
- python-devel
- python-pip
- python3-devel
- python3-pip
- mysql-devel
- zlib-devel
- bzip2-devel
- openssl-devel
Expand All @@ -77,71 +68,52 @@
- marvin_install

- name: remove yum openSSL package
yum:
name: pyOpenSSL
state: absent

- name: Update pip and components
pip:
dnf:
name: "{{ item }}"
extra_args: '--trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --upgrade'
state: absent
with_items:
- pip==20.2.1
- six
- pyOpenSSL
- wheel==0.34.2
- '"requests[security]"'
- pyasn1
- wget
- texttable
- lxml
- paramiko
- setuptools
- pyvmomi==8.0.0.1
tags:
- marvin
- marvin_install

- name: Workaround for pip install kubernetes
pip:
name: "kubernetes"
extra_args: '--ignore-installed'
- python3-pyOpenSSL
- python3-six
- python3-urllib3
- python3-requests

- name: Update pip3 and components
pip:
name: "{{ item }}"
executable: pip3
extra_args: '--upgrade'
with_items:
- pip==21.3.1
- pip
- six
- pyOpenSSL
- wheel==0.34.2
- paramiko
- wheel
- kubernetes
- '"requests[security]"'
- pyasn1
- wget
- texttable
- lxml
- pycparser==2.13
- paramiko
- mysql-connector-python==8.0.29
- netaddr==0.10.1
- pyvmomi==8.0.3.0.1
- pycparser
- mysql-connector-python==8.0.30
- netaddr
- pyvmomi
tags:
- marvin
- marvin_install

- name: Clear all yum cache
command: yum clean all
command: dnf clean all

- name: Ensure CA-Certificates are up to date
yum:
dnf:
name: ca-certificates
state: latest
tags:
- marvin
- marvin_install

- name: ensure atd is running to schedule jobs
service: name=atd state=started enabled=yes
systemd:
name: atd
state: started
enabled: true
97 changes: 21 additions & 76 deletions Ansible/roles/marvin/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@
- kvm

- name: Now I'm connected, get facts
setup:
tags:
- kvm

- include: ../../../tasks/set_centos_repos.yml
os_facts:

- name: Ensure selinux python bindings are installed
yum: name=libselinux-python state=present
- name: Set hostname pt2
shell: "hostnamectl set-hostname {{ inventory_hostname }}"

- name: Ensure selinux python3 bindings are installed
yum: name=libselinux-python3 state=present
dnf: name=python3-libselinux state=present

- name: Ensure sshpass is installed
dnf: name=sshpass state=present

- name: Put SELinux in permissive mode, logging actions that would be blocked.
selinux:
Expand All @@ -36,16 +35,6 @@
- name: sync time with mgmt server
shell: date --set=`sshpass -p 'P@ssword123' ssh -o StrictHostKeyChecking=no root@{{ hostvars[groups['primary_cs_manager'][0]]['ansible_ssh_host'] }} 'date --iso-8601=seconds'`

- name: restart machine for clean time application
command: sleep 2 && /sbin/shutdown -r now "set time"
async: 1
poll: 0
ignore_errors: true

- name: waiting 60 secs for server to come back
become: false
local_action: wait_for host={{ ansible_ssh_host }} port=22 state=started delay=60 timeout=300

- include: ./install_marvin_prereqs.yml

- name: Set repo to install PR tests from
Expand All @@ -69,36 +58,13 @@
when: ("{{ mypackage_available }}" == "false") or (force_marvin_fallback)

- name: Install Marvin package
yum: name=cloudstack-marvin state=present
dnf: name=cloudstack-marvin state=present
tags:
- marvin
- marvin_cfg

- name: Ensure integration test packages are installed
yum: name=cloudstack-integration-tests state=present
tags:
- marvin
- marvin_cfg

- name: Install wheel
pip:
name: wheel
tags:
- marvin

- name: Install nose
pip:
name: nose
tags:
- marvin

- name: Check if marvin is installed in python3
stat: path=/usr/local/lib/python3.6/site-packages/marvin/
register: marvin3

- name: install marvin in python3 if not exist
shell: "pip3 install /usr/share/cloudstack-marvin/Marvin-*.tar.gz"
when: marvin3.stat.exists == false
dnf: name=cloudstack-integration-tests state=present
tags:
- marvin
- marvin_cfg
Expand Down Expand Up @@ -153,13 +119,20 @@
- marvin
- marvin_cfg

- name: get site packages location
shell: pip show requests | awk '/^Location:/{print $2}'
register:
package_dir

- name: Check if marvin is installed in python3
stat: path={{ package_dir.stdout }}/marvin/
register: marvin3

- name: remove orginal test_data files
file: path="{{ item }}" state=absent
with_items:
- "/usr/lib/python2.7/site-packages/marvin/config/test_data.pyc"
- "/usr/lib/python2.7/site-packages/marvin/config/test_data.py"
- "/usr/local/lib/python3.6/site-packages/marvin/config/test_data.pyc"
- "/usr/local/lib/python3.6/site-packages/marvin/config/test_data.py"
- "{{ package_dir.stdout }}/marvin/config/test_data.pyc"
- "{{ package_dir.stdout }}/marvin/config/test_data.py"
tags:
- marvin
- marvin_cfg
Expand All @@ -170,41 +143,13 @@
- marvin
- marvin_cfg

- name: Check if marvin is installed in python2
stat: path=/usr/lib/python2.7/site-packages/marvin/
register: marvin2

- name: create symlink to test_data.py
file: src=/marvin/test_data.py dest=/usr/lib/python2.7/site-packages/marvin/config/test_data.py state=link mode=0644
when: marvin2.stat.exists == true
tags:
- marvin
- marvin_cfg

- name: Check if marvin is installed in python3
stat: path=/usr/local/lib/python3.6/site-packages/marvin/
register: marvin3

- name: create python3 symlink to test_data.py
file: src=/marvin/test_data.py dest=/usr/local/lib/python3.6/site-packages/marvin/config/test_data.py state=link mode=0644
file: src=/marvin/test_data.py dest={{ package_dir.stdout }}/marvin/config/test_data.py state=link mode=0644
when: marvin3.stat.exists == true
tags:
- marvin
- marvin_cfg

# Install specific version of mysql-connector-python for compatibility with MariaDB
# For more details: https://stackoverflow.com/a/73254598/3428543
- name: Install mysql-connector-python==8.0.29
pip:
name: "{{ item }}"
executable: pip3
extra_args: '--upgrade'
with_items:
- mysql-connector-python==8.0.29
tags:
- marvin
- marvin_install

- name: create common functions file
template: src="common_functions.sh.j2" dest="/marvin/common_functions.sh" mode=0755
tags:
Expand Down
5 changes: 3 additions & 2 deletions Ansible/roles/marvin/templates/componenttests.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set +e # stop erroneous failures reported by Jenkins
TESTTYPE="Component tests"
LOGDIR=/marvin/MarvinLogs
TESTDIR="/marvin/tests/component"
SUMMARY_FILE=/marvin/componenttest-summary.txt
SUMMARY_FILE=/marvin/componenttests-summary.txt
TMP_JSON_DIR="/marvin/json_results/"
CLEAN_UP_LOG="/marvin/cleanup.log"
mkdir -p $LOGDIR
Expand Down Expand Up @@ -74,7 +74,8 @@ for file in $FILES; do
{% if use_hipchat %}
hipchat --action sendNotification --room "Marvin Notifications" --messageFormat "html" --colour "gray" --message "Starting <b>$(basename $file)</b> on {{ hostvars[groups['marvin_host'][0]]['ansible_ssh_host'] }} in: <br><b>{{ env_name_clean }}</b> - test ($counter of $NUMTESTS)"
{% endif %}
{% if use_slack %} slackmsg "Starting $TESTFILENAME on {{ hostvars[groups['marvin_host'][0]]['ansible_ssh_host'] }}.\nTest ($counter of $NUMTESTS) " "#808080"
{% if use_slack %}
slackmsg "Starting $TESTFILENAME on {{ hostvars[groups['marvin_host'][0]]['ansible_ssh_host'] }}.\nTest ($counter of $NUMTESTS) " "#808080"
{% endif %}
start_time="$(date -u +%s)"
launchtest $file
Expand Down