From d4c4665d00b1229d1a408a0eb67148c298753c8f Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 4 Sep 2020 15:10:49 +0100 Subject: [PATCH] Fix CA file for API client If a custom CA file is configured via OPENSTACK_SSL_CACERT, currently communication with Keystone will fail, since the session is not created using this CA file. This change fixes the issue by passing the path to the CA file to the keystoneauth session constructor. Change-Id: Iad1bdea97ed649cc3c8f042dc5dd147b989dfd0e Closes-Bug: #1873736 (cherry picked from commit 59ee1d59a1e08cd2245a8e876ea8931419ac5e32) --- masakaridashboard/api/api.py | 3 ++- releasenotes/notes/fix-cacert-023407ba61a4bb7a.yaml | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-cacert-023407ba61a4bb7a.yaml diff --git a/masakaridashboard/api/api.py b/masakaridashboard/api/api.py index 9438553..ea0da77 100644 --- a/masakaridashboard/api/api.py +++ b/masakaridashboard/api/api.py @@ -39,7 +39,8 @@ def openstack_connection(request, version=None): token=request.user.token.id, project_name=request.user.project_name, project_id=request.user.tenant_id) - session = ks_session.Session(auth=auth) + cacert = getattr(settings, 'OPENSTACK_SSL_CACERT') + session = ks_session.Session(auth=auth, verify=cacert or True) conn = connection.Connection(session=session, ha_api_version=version) diff --git a/releasenotes/notes/fix-cacert-023407ba61a4bb7a.yaml b/releasenotes/notes/fix-cacert-023407ba61a4bb7a.yaml new file mode 100644 index 0000000..f3249f3 --- /dev/null +++ b/releasenotes/notes/fix-cacert-023407ba61a4bb7a.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes an issue where the dashboard fails to load if communication with the + API requires a custom CA certificate.