summaryrefslogtreecommitdiffstats
path: root/apex/deployment
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2018-08-13 14:51:09 -0400
committerTim Rozet <trozet@redhat.com>2018-08-14 15:38:59 -0400
commitae5fcc0dd1d19c750cba8d9bf16545f5a7802287 (patch)
tree8bd9601966ded90b63373ccaa3ac3993d21beffa /apex/deployment
parentc5959cc14b95e9d10b78ebf3c8e2525c672fc0c7 (diff)
Allow common patches file
This patch adds allowing for common patches that should be applied to every scenario to be included. It by default pulls in a file in the deploy directory 'common-patches.yaml', but can optionally be overridden. This patch also includes a patch upstream to fix OSCLI not working anymore due to breakage with the Cinder version in the overcloudrc. Change-Id: I97b9efb937deff07e085b9ef75b9799fb65bfc57 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'apex/deployment')
-rw-r--r--apex/deployment/__init__.py0
-rw-r--r--apex/deployment/tripleo.py59
2 files changed, 59 insertions, 0 deletions
diff --git a/apex/deployment/__init__.py b/apex/deployment/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/apex/deployment/__init__.py
diff --git a/apex/deployment/tripleo.py b/apex/deployment/tripleo.py
new file mode 100644
index 00000000..0f85bbae
--- /dev/null
+++ b/apex/deployment/tripleo.py
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2018 Tim Rozet (trozet@redhat.com) and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# TODO(trozet): this will serve as the deployment class as we migrate logic out
+# of deploy.py
+import logging
+import os
+import pprint
+
+from apex.common.exceptions import ApexDeployException
+from apex.common import utils
+
+
+class ApexDeployment:
+ def __init__(self, deploy_settings, patch_file, ds_file):
+ self.ds = deploy_settings
+ # TODO(trozet): remove ds_file from args and have this class inherit
+ # super deployment class init which does all the settings
+ self.ds_file = ds_file
+ self.ds_globals = self.ds['global_params']
+ self.p_file = patch_file
+
+ def determine_patches(self):
+ patches = self.ds_globals['patches']
+ if not os.path.isfile(self.p_file):
+ new_file = os.path.join(os.path.dirname(self.ds_file),
+ 'common-patches.yaml')
+ if os.path.isfile(new_file):
+ logging.warning('Patch file {} not found, falling back to '
+ '{}'.format(self.p_file, new_file))
+ self.p_file = new_file
+ else:
+ logging.error('Unable to find common patch file: '
+ '{}'.format(self.p_file))
+ raise ApexDeployException(
+ 'Specified common patch file not found: {}'.format(
+ self.p_file))
+ logging.info('Loading patches from common patch file {}'.format(
+ self.p_file))
+ 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')
+ 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] +
+ common_patches[ptype])
+ return patches