Merge "After leapp has been run, verify that the kernel has been upgraded."
This commit is contained in:
commit
c12dfdbbb2
|
@ -0,0 +1,6 @@
|
|||
===========================
|
||||
Role - check_kernel_version
|
||||
===========================
|
||||
|
||||
.. ansibleautoplugin::
|
||||
:role: roles/check_kernel_version
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: all
|
||||
gather_facts: true
|
||||
vars:
|
||||
metadata:
|
||||
name: Verify the kernel version contains el8 in its name
|
||||
description: >
|
||||
This validation checks the kernel has been upgaded by checking
|
||||
el8 is in kernel (uname -r) version string
|
||||
groups:
|
||||
- post-deployment
|
||||
roles:
|
||||
- check_kernel_version
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
check_kernel_version_fact: "{{ ansible_facts.kernel }}"
|
||||
check_kernel_version_expected: "el8"
|
|
@ -0,0 +1,37 @@
|
|||
# Molecule managed
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
|
||||
|
||||
{% for pkg in item.easy_install | default([]) %}
|
||||
# install pip for centos where there is no python-pip rpm in default repos
|
||||
RUN easy_install {{ pkg }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
# Copyright 2020 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Converge
|
||||
hosts: all
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: validate correct kernel version
|
||||
include_role:
|
||||
name: "check_kernel_version"
|
||||
|
||||
- name: detect wrong kernel version
|
||||
block:
|
||||
- name: run validation against wrong kernel version
|
||||
include_role:
|
||||
name: "check_kernel_version"
|
||||
vars:
|
||||
check_kernel_version_fact: "4.18.0-193.14.2.el7_2.x86_64"
|
||||
rescue:
|
||||
- name: Clear host errors
|
||||
meta: clear_host_errors
|
||||
|
||||
- name: Status message
|
||||
debug:
|
||||
msg: "Detected kernel version mismatch!"
|
||||
|
||||
- name: End play
|
||||
meta: end_play
|
||||
|
||||
- name: Fail the test
|
||||
fail:
|
||||
msg: |
|
||||
The kernel version mismatch should have been detected but it wasn't.
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
driver:
|
||||
name: docker
|
||||
|
||||
log: true
|
||||
|
||||
platforms:
|
||||
- name: centos8
|
||||
hostname: centos8
|
||||
image: centos:8
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python*-setuptools
|
||||
volumes:
|
||||
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||
environment:
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
log: true
|
||||
env:
|
||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||
ANSIBLE_LIBRARY: "../../../../library"
|
||||
|
||||
scenario:
|
||||
test_sequence:
|
||||
- destroy
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- verify
|
||||
- destroy
|
||||
|
||||
verifier:
|
||||
name: testinfra
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
# Copyright 2020 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Check kernel version
|
||||
fail:
|
||||
msg: '{{ check_kernel_version_expected }} does not match configured kernel_version {{ check_kernel_version_fact }}'
|
||||
when: check_kernel_version_expected not in check_kernel_version_fact
|
|
@ -20,6 +20,7 @@
|
|||
- tripleo-validations-centos-8-molecule-undercloud_debug
|
||||
- tripleo-validations-centos-8-molecule-undercloud_heat_purge_deleted
|
||||
- tripleo-validations-centos-8-molecule-undercloud_tokenflush
|
||||
- tripleo-validations-centos-8-molecule-check_kernel_version
|
||||
gate:
|
||||
jobs:
|
||||
- tripleo-validations-centos-8-molecule-ceph
|
||||
|
@ -40,6 +41,7 @@
|
|||
- tripleo-validations-centos-8-molecule-undercloud_debug
|
||||
- tripleo-validations-centos-8-molecule-undercloud_heat_purge_deleted
|
||||
- tripleo-validations-centos-8-molecule-undercloud_tokenflush
|
||||
- tripleo-validations-centos-8-molecule-check_kernel_version
|
||||
name: tripleo-validations-molecule-jobs
|
||||
- job:
|
||||
files:
|
||||
|
@ -314,3 +316,10 @@
|
|||
parent: tripleo-validations-centos-8-base
|
||||
vars:
|
||||
tripleo_validations_role_name: package_version
|
||||
- job:
|
||||
files:
|
||||
- ^roles/check_kernel_version/.*
|
||||
name: tripleo-validations-centos-8-molecule-check_kernel_version
|
||||
parent: tripleo-validations-centos-8-base
|
||||
vars:
|
||||
tripleo_validations_role_name: check_kernel_version
|
||||
|
|
Loading…
Reference in New Issue