diff options
author | Tim Rozet <trozet@redhat.com> | 2018-02-16 10:45:55 -0500 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2018-02-16 10:59:39 -0500 |
commit | 2beef21903d7a36bdac19b3170003043693562dd (patch) | |
tree | 16915957eccb08d19f1a5442fb6f5528416c72c8 /apex/undercloud/undercloud.py | |
parent | 2111e5a85f8d0a894e1a7684c2e1a6d897091c9d (diff) |
Fixes stale undercloud delorean repos
When we build artifacts for release, we try to freeze the disk images
and artifacts we use for deployment. This includes the delorean repo
which provides OpenStack packages. This repo however expires after a
couple months and then if any packages were missing in the Undercloud
released artifact, they will attempt to be downloaded during install
and fail.
This patch adds some logic to detect if there is internet connectivity,
and if so then download and update the delorean repo on the undercloud.
JIRA: APEX-565
Change-Id: I58c28437fb5c5b179033c939377fd97aefbf427c
Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'apex/undercloud/undercloud.py')
-rw-r--r-- | apex/undercloud/undercloud.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/apex/undercloud/undercloud.py b/apex/undercloud/undercloud.py index d28ed981..4490ed20 100644 --- a/apex/undercloud/undercloud.py +++ b/apex/undercloud/undercloud.py @@ -31,8 +31,10 @@ class Undercloud: """ def __init__(self, image_path, template_path, root_pw=None, external_network=False, - image_name='undercloud.qcow2'): + image_name='undercloud.qcow2', + os_version=constants.DEFAULT_OS_VERSION): self.ip = None + self.os_version = os_version self.root_pw = root_pw self.external_net = external_network self.volume = os.path.join(constants.LIBVIRT_VOLUME_PATH, @@ -73,6 +75,7 @@ class Undercloud: template_dir=self.template_path) self.setup_volumes() self.inject_auth() + self._update_delorean_repo() def _set_ip(self): ip_out = self.vm.interfaceAddresses( @@ -237,3 +240,18 @@ class Undercloud: } return config + + def _update_delorean_repo(self): + if utils.internet_connectivity(): + logging.info('Updating delorean repo on Undercloud') + delorean_repo = ( + "https://trunk.rdoproject.org/centos7-{}" + "/current-tripleo/delorean.repo".format(self.os_version)) + cmd = ("curl -L -f -o " + "/etc/yum.repos.d/deloran.repo {}".format(delorean_repo)) + try: + virt_utils.virt_customize({constants.VIRT_RUN_CMD: cmd}, + self.volume) + except Exception: + logging.warning("Failed to download and update delorean repo " + "for Undercloud") |