Add support for cafile option in the gnocchi fetcher

Change-Id: Id0c8e8ada7fae6fd663a6421d38507c7f1bde891
This commit is contained in:
Luka Peschke 2019-01-08 15:41:08 +01:00
parent e8e175e74f
commit 838ec237e4
1 changed files with 10 additions and 2 deletions

View File

@ -61,7 +61,8 @@ gfetcher_opts = [
cfg.StrOpt(
'region_name',
default='RegionOne',
help='Region Name'),
help='Region Name',
),
]
@ -83,6 +84,7 @@ class GnocchiFetcher(fetcher.BaseFetcher):
def __init__(self):
super(GnocchiFetcher, self).__init__()
adapter_options = {'connect_retries': 3}
if CONF.fetcher_gnocchi.gnocchi_auth_type == 'keystone':
auth_plugin = ks_loading.load_auth_from_conf_options(
@ -97,9 +99,15 @@ class GnocchiFetcher(fetcher.BaseFetcher):
)
adapter_options['region_name'] = CONF.fetcher_gnocchi.region_name
verify = True
if CONF.fetcher_gnocchi.cafile:
verify = CONF.fetcher_gnocchi.cafile
elif CONF.fetcher_gnocchi.insecure:
verify = False
self._conn = gclient.Client(
'1',
session_options={'auth': auth_plugin},
session_options={'auth': auth_plugin, 'verify': verify},
adapter_options=adapter_options,
)