diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-02-22 12:16:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-22 12:16:39 -0500 |
commit | 5b2023504639049ad1fd2c70a5d96802ae307e63 (patch) | |
tree | 4700a21ad4309ed202bc3a9fa3147d5919ab246c /roles/lib_openshift/src/class/oc_adm_router.py | |
parent | 9900db7dbc1e8544972861f259dd4b7e911cfa22 (diff) | |
parent | 060455ecd15a8ee714cac32aab667e747df1074e (diff) | |
download | openshift-5b2023504639049ad1fd2c70a5d96802ae307e63.tar.gz openshift-5b2023504639049ad1fd2c70a5d96802ae307e63.tar.bz2 openshift-5b2023504639049ad1fd2c70a5d96802ae307e63.tar.xz openshift-5b2023504639049ad1fd2c70a5d96802ae307e63.zip |
Merge pull request #3447 from kwoodson/router_no_default_cert
Fix for no default_cert or cert, key, cacert files
Diffstat (limited to 'roles/lib_openshift/src/class/oc_adm_router.py')
-rw-r--r-- | roles/lib_openshift/src/class/oc_adm_router.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/roles/lib_openshift/src/class/oc_adm_router.py b/roles/lib_openshift/src/class/oc_adm_router.py index 9d61cfdf2..ab7c96927 100644 --- a/roles/lib_openshift/src/class/oc_adm_router.py +++ b/roles/lib_openshift/src/class/oc_adm_router.py @@ -180,10 +180,14 @@ class Router(OpenShiftCLI): return deploymentconfig + # pylint: disable=too-many-branches def _prepare_router(self): '''prepare router for instantiation''' - # We need to create the pem file - if self.config.config_options['default_cert']['value'] is None: + # if cacert, key, and cert were passed, combine them into a pem file + if (self.config.config_options['cacert_file']['value'] and + self.config.config_options['cert_file']['value'] and + self.config.config_options['key_file']['value']): + router_pem = '/tmp/router.pem' with open(router_pem, 'w') as rfd: rfd.write(open(self.config.config_options['cert_file']['value']).read()) @@ -193,8 +197,13 @@ class Router(OpenShiftCLI): rfd.write(open(self.config.config_options['cacert_file']['value']).read()) atexit.register(Utils.cleanup, [router_pem]) + self.config.config_options['default_cert']['value'] = router_pem + elif self.config.config_options['default_cert']['value'] is None: + # No certificate was passed to us. do not pass one to oc adm router + self.config.config_options['default_cert']['include'] = False + options = self.config.to_option_list() cmd = ['router', self.config.name, '-n', self.config.namespace] @@ -235,7 +244,8 @@ class Router(OpenShiftCLI): oc_objects['DeploymentConfig']['obj'] = self.add_modifications(oc_objects['DeploymentConfig']['obj']) for oc_type, oc_data in oc_objects.items(): - oc_data['path'] = Utils.create_tmp_file_from_contents(oc_type, oc_data['obj'].yaml_dict) + if oc_data['obj'] is not None: + oc_data['path'] = Utils.create_tmp_file_from_contents(oc_type, oc_data['obj'].yaml_dict) return oc_objects @@ -245,7 +255,8 @@ class Router(OpenShiftCLI): # pylint: disable=no-member for _, oc_data in self.prepared_router.items(): - results.append(self._create(oc_data['path'])) + if oc_data['obj'] is not None: + results.append(self._create(oc_data['path'])) rval = 0 for result in results: |