From 2beef21903d7a36bdac19b3170003043693562dd Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Fri, 16 Feb 2018 10:45:55 -0500 Subject: 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 --- apex/tests/test_apex_undercloud.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'apex/tests') diff --git a/apex/tests/test_apex_undercloud.py b/apex/tests/test_apex_undercloud.py index c821ade5..0df785f9 100644 --- a/apex/tests/test_apex_undercloud.py +++ b/apex/tests/test_apex_undercloud.py @@ -197,3 +197,18 @@ class TestUndercloud(unittest.TestCase): ds = {'global_params': {}} Undercloud('img_path', 'tplt_path').generate_config(ns, ds) + + @patch.object(Undercloud, '_get_vm', return_value=None) + @patch.object(Undercloud, 'create') + @patch('apex.undercloud.undercloud.virt_utils') + def test_update_delorean(self, mock_vutils, mock_uc_create, mock_get_vm): + uc = Undercloud('img_path', 'tmplt_path', external_network=True) + uc._update_delorean_repo() + download_cmd = ( + "curl -L -f -o " + "/etc/yum.repos.d/deloran.repo " + "https://trunk.rdoproject.org/centos7-{}" + "/current-tripleo/delorean.repo".format( + constants.DEFAULT_OS_VERSION)) + test_ops = {'--run-command': download_cmd} + mock_vutils.virt_customize.assert_called_with(test_ops, uc.volume) -- cgit 1.2.3-korg