summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/class
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-02-06 21:04:59 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-02-08 12:17:33 -0500
commit2c2783db79faa780709ef16c3a1a71378ec2f4e3 (patch)
treece1e41ee47b2e54fe6b064cd3e9941d2bb0bb629 /roles/lib_openshift/src/class
parentb1565e9e843e99c6b3c0d99518c27249472f57fe (diff)
downloadopenshift-2c2783db79faa780709ef16c3a1a71378ec2f4e3.tar.gz
openshift-2c2783db79faa780709ef16c3a1a71378ec2f4e3.tar.bz2
openshift-2c2783db79faa780709ef16c3a1a71378ec2f4e3.tar.xz
openshift-2c2783db79faa780709ef16c3a1a71378ec2f4e3.zip
Adding port support for route.
Diffstat (limited to 'roles/lib_openshift/src/class')
-rw-r--r--roles/lib_openshift/src/class/oc_route.py43
1 files changed, 41 insertions, 2 deletions
diff --git a/roles/lib_openshift/src/class/oc_route.py b/roles/lib_openshift/src/class/oc_route.py
index 42af2c01c..42388ad0b 100644
--- a/roles/lib_openshift/src/class/oc_route.py
+++ b/roles/lib_openshift/src/class/oc_route.py
@@ -64,9 +64,23 @@ class OCRoute(OpenShiftCLI):
skip = []
return not Utils.check_def_equal(self.config.data, self.route.yaml_dict, skip_keys=skip, debug=True)
+ @staticmethod
+ def get_cert_data(path, content):
+ '''get the data for a particular value'''
+ if not path and not content:
+ return None
+
+ rval = None
+ if path and os.path.exists(path) and os.access(path, os.R_OK):
+ rval = open(path).read()
+ elif content:
+ rval = content
+
+ return rval
+
# pylint: disable=too-many-return-statements,too-many-branches
@staticmethod
- def run_ansible(params, files, check_mode=False):
+ def run_ansible(params, check_mode=False):
''' run the idempotent asnible code
params comes from the ansible portion for this module
@@ -78,6 +92,30 @@ class OCRoute(OpenShiftCLI):
}
check_mode: does the module support check mode. (module.check_mode)
'''
+ files = {'destcacert': {'path': params['dest_cacert_path'],
+ 'content': params['dest_cacert_content'],
+ 'value': None, },
+ 'cacert': {'path': params['cacert_path'],
+ 'content': params['cacert_content'],
+ 'value': None, },
+ 'cert': {'path': params['cert_path'],
+ 'content': params['cert_content'],
+ 'value': None, },
+ 'key': {'path': params['key_path'],
+ 'content': params['key_content'],
+ 'value': None, }, }
+
+ if params['tls_termination'] and params['tls_termination'].lower() != 'passthrough': # E501
+
+ for key, option in files.items():
+ if key == 'destcacert' and params['tls_termination'] != 'reencrypt':
+ continue
+
+ option['value'] = OCRoute.get_cert_data(option['path'], option['content']) # E501
+
+ if not option['value']:
+ return {'failed': True,
+ 'msg': 'Verify that you pass a value for %s' % key}
rconfig = RouteConfig(params['name'],
params['namespace'],
@@ -90,7 +128,8 @@ class OCRoute(OpenShiftCLI):
params['tls_termination'],
params['service_name'],
params['wildcard_policy'],
- params['weight'])
+ params['weight'],
+ params['port'])
oc_route = OCRoute(rconfig, verbose=params['debug'])