summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2018-08-14 21:17:33 -0400
committerTim Rozet <trozet@redhat.com>2018-08-15 10:58:31 -0400
commitc0a4aa96bbe70eefb179d59a1267b8115651bba5 (patch)
tree27fdca2b00d5ef995d00bf7e91922d78358123bd
parentae5fcc0dd1d19c750cba8d9bf16545f5a7802287 (diff)
Modify common patches schema to per branch
The common patch design doesn't really work across branches very well. This patch makes it so the common patches are specified in the same file, but on a per branch basis. Making it easier to manage common patches per branch. Also, includes a fix and adds test coverage to the prep_image method where we were referencing 'undercloud_admin_ip' before assignment in a case where we were not using ODL and had patches to overcloud. Change-Id: I7672947afd826fdc0042361a0139e22d6d5dd864 Signed-off-by: Tim Rozet <trozet@redhat.com>
-rw-r--r--apex/deployment/tripleo.py11
-rw-r--r--apex/overcloud/deploy.py4
-rw-r--r--apex/tests/config/common-patches.yaml7
-rw-r--r--apex/tests/test_apex_overcloud_deploy.py28
-rw-r--r--config/deploy/common-patches.yaml26
-rw-r--r--config/deploy/os-nosdn-nofeature-ha.yaml1
-rw-r--r--config/deploy/os-nosdn-nofeature-noha.yaml1
-rw-r--r--config/deploy/os-odl-bgpvpn-ha.yaml5
-rw-r--r--config/deploy/os-odl-bgpvpn-noha.yaml5
-rw-r--r--config/deploy/os-odl-nofeature-ha.yaml6
-rw-r--r--config/deploy/os-odl-nofeature-noha.yaml6
-rw-r--r--config/deploy/os-odl-queens-ha.yaml6
-rw-r--r--config/deploy/os-odl-queens-noha.yaml6
13 files changed, 68 insertions, 44 deletions
diff --git a/apex/deployment/tripleo.py b/apex/deployment/tripleo.py
index 0f85bbae..c131e161 100644
--- a/apex/deployment/tripleo.py
+++ b/apex/deployment/tripleo.py
@@ -46,12 +46,13 @@ class ApexDeployment:
common_patches = utils.parse_yaml(self.p_file)
logging.debug('Content from common patch file is: {}'.format(
pprint.pformat(common_patches)))
- if 'patches' not in common_patches.keys():
- logging.error('Error parsing common patches file, wrong format. '
- 'Missing "patches" dictionary')
+ os_version = self.ds['deploy_options']['os_version']
+ try:
+ common_patches = common_patches['patches'][os_version]
+ except KeyError:
+ logging.error('Error parsing common patches file, wrong format.')
raise ApexDeployException('Invalid format of common patch file')
- else:
- common_patches = common_patches['patches']
+
for ptype in ('undercloud', 'overcloud'):
if ptype in common_patches:
patches[ptype] = utils.unique(patches[ptype] +
diff --git a/apex/overcloud/deploy.py b/apex/overcloud/deploy.py
index dd476b6f..e310fa21 100644
--- a/apex/overcloud/deploy.py
+++ b/apex/overcloud/deploy.py
@@ -395,9 +395,9 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None,
"/root/nosdn_vpp_rpms/*.rpm"}
])
+ undercloud_admin_ip = ns['networks'][con.ADMIN_NETWORK][
+ 'installer_vm']['ip']
if sdn == 'opendaylight':
- undercloud_admin_ip = ns['networks'][con.ADMIN_NETWORK][
- 'installer_vm']['ip']
oc_builder.inject_opendaylight(
odl_version=ds_opts['odl_version'],
image=tmp_oc_image,
diff --git a/apex/tests/config/common-patches.yaml b/apex/tests/config/common-patches.yaml
index 35dbf449..fef8fcd0 100644
--- a/apex/tests/config/common-patches.yaml
+++ b/apex/tests/config/common-patches.yaml
@@ -1,5 +1,6 @@
---
patches:
- undercloud:
- - change-id: I2e0a40d7902f592e4b7bd727f57048111e0bea36
- project: openstack/tripleo-common
+ queens:
+ undercloud:
+ - change-id: I2e0a40d7902f592e4b7bd727f57048111e0bea36
+ project: openstack/tripleo-common
diff --git a/apex/tests/test_apex_overcloud_deploy.py b/apex/tests/test_apex_overcloud_deploy.py
index a9e4bda5..9dd5289d 100644
--- a/apex/tests/test_apex_overcloud_deploy.py
+++ b/apex/tests/test_apex_overcloud_deploy.py
@@ -284,6 +284,34 @@ class TestOvercloudDeploy(unittest.TestCase):
mock_c_builder.add_upstream_patches.assert_called()
self.assertListEqual(sorted(rv), ['nova-api', 'opendaylight'])
+ @patch('apex.overcloud.deploy.c_builder')
+ @patch('apex.overcloud.deploy.oc_builder')
+ @patch('apex.overcloud.deploy.virt_utils')
+ @patch('apex.overcloud.deploy.shutil')
+ @patch('apex.overcloud.deploy.os.path')
+ @patch('builtins.open', mock_open())
+ def test_prep_image_nosdn_upstream_containers_patches(
+ self, mock_os_path, mock_shutil, mock_virt_utils,
+ mock_oc_builder, mock_c_builder):
+ ds_opts = {'dataplane': 'ovs',
+ 'sdn_controller': False,
+ 'odl_version': con.DEFAULT_ODL_VERSION,
+ 'odl_vpp_netvirt': False}
+ ds = {'deploy_options': MagicMock(),
+ 'global_params': MagicMock()}
+ ds['deploy_options'].__getitem__.side_effect = \
+ lambda i: ds_opts.get(i, MagicMock())
+ ds['deploy_options'].__contains__.side_effect = \
+ lambda i: True if i in ds_opts else MagicMock()
+ ns = MagicMock()
+ mock_c_builder.add_upstream_patches.return_value = ['nova-api']
+ patches = ['dummy_nova_patch']
+ rv = prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test',
+ docker_tag='latest', patches=patches)
+ mock_virt_utils.virt_customize.assert_called()
+ mock_c_builder.add_upstream_patches.assert_called()
+ self.assertListEqual(sorted(rv), ['nova-api'])
+
@patch('apex.overcloud.deploy.oc_builder')
@patch('apex.overcloud.deploy.virt_utils')
@patch('apex.overcloud.deploy.shutil')
diff --git a/config/deploy/common-patches.yaml b/config/deploy/common-patches.yaml
index 7339e79c..ac006bdd 100644
--- a/config/deploy/common-patches.yaml
+++ b/config/deploy/common-patches.yaml
@@ -1,8 +1,22 @@
---
patches:
- undercloud:
- - change-id: I2e0a40d7902f592e4b7bd727f57048111e0bea36
- project: openstack/tripleo-common
- - change-id: Iaa2276aadae351fbc138de258c51d786f69e4395
- project: openstack/tripleo-common
- branch: master
+ master:
+ undercloud:
+ - change-id: I2e0a40d7902f592e4b7bd727f57048111e0bea36
+ project: openstack/tripleo-common
+ - change-id: Iaa2276aadae351fbc138de258c51d786f69e4395
+ project: openstack/tripleo-common
+ overcloud:
+ - change-id: Ie988ba6a2d444a614e97c0edf5fce24b23970310
+ project: openstack/puppet-tripleo
+ - change-id: I93e3d355625508fdc42f44bdd358f3ba86fbd8d7
+ project: openstack/puppet-tripleo
+ queens:
+ undercloud:
+ - change-id: I966bf7f6f8d1cbc656abfad59e8bb927e1aa53c2
+ project: openstack/tripleo-common
+ overcloud:
+ - change-id: Ie988ba6a2d444a614e97c0edf5fce24b23970310
+ project: openstack/puppet-tripleo
+ - change-id: I93e3d355625508fdc42f44bdd358f3ba86fbd8d7
+ project: openstack/puppet-tripleo
diff --git a/config/deploy/os-nosdn-nofeature-ha.yaml b/config/deploy/os-nosdn-nofeature-ha.yaml
index 26d30e5e..d896a672 100644
--- a/config/deploy/os-nosdn-nofeature-ha.yaml
+++ b/config/deploy/os-nosdn-nofeature-ha.yaml
@@ -1,6 +1,7 @@
---
global_params:
ha_enabled: true
+
deploy_options:
containers: true
os_version: master
diff --git a/config/deploy/os-nosdn-nofeature-noha.yaml b/config/deploy/os-nosdn-nofeature-noha.yaml
index e7758113..0725031f 100644
--- a/config/deploy/os-nosdn-nofeature-noha.yaml
+++ b/config/deploy/os-nosdn-nofeature-noha.yaml
@@ -1,6 +1,7 @@
---
global_params:
ha_enabled: false
+
deploy_options:
containers: true
os_version: master
diff --git a/config/deploy/os-odl-bgpvpn-ha.yaml b/config/deploy/os-odl-bgpvpn-ha.yaml
index 80b5b3b1..f61e1a60 100644
--- a/config/deploy/os-odl-bgpvpn-ha.yaml
+++ b/config/deploy/os-odl-bgpvpn-ha.yaml
@@ -1,10 +1,7 @@
---
global_params:
ha_enabled: true
- patches:
- undercloud:
- - change-id: I2e0a40d7902f592e4b7bd727f57048111e0bea36
- project: openstack/tripleo-common
+
deploy_options:
containers: true
os_version: master
diff --git a/config/deploy/os-odl-bgpvpn-noha.yaml b/config/deploy/os-odl-bgpvpn-noha.yaml
index 04dbaa89..4bf90aa7 100644
--- a/config/deploy/os-odl-bgpvpn-noha.yaml
+++ b/config/deploy/os-odl-bgpvpn-noha.yaml
@@ -1,10 +1,7 @@
---
global_params:
ha_enabled: false
- patches:
- undercloud:
- - change-id: I2e0a40d7902f592e4b7bd727f57048111e0bea36
- project: openstack/tripleo-common
+
deploy_options:
containers: true
os_version: master
diff --git a/config/deploy/os-odl-nofeature-ha.yaml b/config/deploy/os-odl-nofeature-ha.yaml
index a1f0d81e..748da3c7 100644
--- a/config/deploy/os-odl-nofeature-ha.yaml
+++ b/config/deploy/os-odl-nofeature-ha.yaml
@@ -1,11 +1,7 @@
---
global_params:
ha_enabled: true
- patches:
- overcloud:
- - change-id: Ie988ba6a2d444a614e97c0edf5fce24b23970310
- project: openstack/puppet-tripleo
- branch: master
+
deploy_options:
containers: true
os_version: master
diff --git a/config/deploy/os-odl-nofeature-noha.yaml b/config/deploy/os-odl-nofeature-noha.yaml
index 55f14426..0767822b 100644
--- a/config/deploy/os-odl-nofeature-noha.yaml
+++ b/config/deploy/os-odl-nofeature-noha.yaml
@@ -1,11 +1,7 @@
---
global_params:
ha_enabled: false
- patches:
- overcloud:
- - change-id: Ie988ba6a2d444a614e97c0edf5fce24b23970310
- project: openstack/puppet-tripleo
- branch: master
+
deploy_options:
containers: true
os_version: master
diff --git a/config/deploy/os-odl-queens-ha.yaml b/config/deploy/os-odl-queens-ha.yaml
index 1295de04..9738be38 100644
--- a/config/deploy/os-odl-queens-ha.yaml
+++ b/config/deploy/os-odl-queens-ha.yaml
@@ -1,11 +1,7 @@
---
global_params:
ha_enabled: true
- patches:
- overcloud:
- - change-id: Ie988ba6a2d444a614e97c0edf5fce24b23970310
- project: openstack/puppet-tripleo
- branch: stable/queens
+
deploy_options:
containers: true
os_version: queens
diff --git a/config/deploy/os-odl-queens-noha.yaml b/config/deploy/os-odl-queens-noha.yaml
index d3d42476..0500eec1 100644
--- a/config/deploy/os-odl-queens-noha.yaml
+++ b/config/deploy/os-odl-queens-noha.yaml
@@ -1,11 +1,7 @@
---
global_params:
ha_enabled: false
- patches:
- overcloud:
- - change-id: Ie988ba6a2d444a614e97c0edf5fce24b23970310
- project: openstack/puppet-tripleo
- branch: stable/queens
+
deploy_options:
containers: true
os_version: queens