Check repository availability

Change-Id: Idd7c1663f6378c86b6fef7cfb1e77faedc3e57ea
Implements: blueprint pre-upgrade-validations
This commit is contained in:
Florian Fuchs 2017-06-23 20:56:19 +02:00
parent fb7346fbfc
commit 3cc9a39053
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
features:
- |
Adds a validation to the pre-upgrade group that checks if current
repositories can be connected to and if there is at least one repo
configured in yum repolist.

View File

@ -0,0 +1,23 @@
---
- hosts: undercloud, overcloud
vars:
metadata:
name: Check availability of current repositories
description: >
Detect whether the repositories listed in `yum repolist`
can be connected to and that there is at least one repo
configured.
groups:
- pre-upgrade
tasks:
- name: Find repository URLs
shell: 'yum repolist -v | grep Repo-baseurl | sed "s/Repo-baseurl.*\(http[^ ]*\).*/\1/g"'
register: repository_urls
- name: Check if there is at least one repository baseurl
fail:
msg: No repository found in yum repolist
when: repository_urls.stdout_lines|length < 1
- name: Call repository URLs
uri:
url: "{{ item }}"
with_items: repository_urls.stdout_lines