From 4566d1cfc9651014af4fa61247f13f8104c59b8e Mon Sep 17 00:00:00 2001
From: Narasimha SV <narasimha18sv@gmail.com>
Date: Thu, 6 Apr 2017 09:30:03 -0400
Subject: [PATCH] enable CORS for Gnocchi and Keystone for grafana datasource

adding cors section to keystone and gnocchi templates when
grafana is enabled

Change-Id: I54f4c06ed64254df0f9481e461c9393a399212a3
Closes-bug: #1651796
---
 ansible/roles/gnocchi/templates/gnocchi.conf.j2   | 5 +++++
 ansible/roles/keystone/templates/keystone.conf.j2 | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/ansible/roles/gnocchi/templates/gnocchi.conf.j2 b/ansible/roles/gnocchi/templates/gnocchi.conf.j2
index 835e063ca..2bf1f7582 100644
--- a/ansible/roles/gnocchi/templates/gnocchi.conf.j2
+++ b/ansible/roles/gnocchi/templates/gnocchi.conf.j2
@@ -55,3 +55,8 @@ ceph_username = gnocchi
 ceph_keyring = /etc/ceph/ceph.client.gnocchi.keyring
 ceph_conffile = /etc/ceph/ceph.conf
 {% endif %}
+
+{% if enable_grafana | bool %}
+[cors]
+allowed_origin = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ grafana_server_port }}
+{% endif %}
diff --git a/ansible/roles/keystone/templates/keystone.conf.j2 b/ansible/roles/keystone/templates/keystone.conf.j2
index 886e4d94f..007fa061c 100644
--- a/ansible/roles/keystone/templates/keystone.conf.j2
+++ b/ansible/roles/keystone/templates/keystone.conf.j2
@@ -53,3 +53,8 @@ hmac_keys = {{ osprofiler_secret }}
 connection_string = elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}
 {% endif %}
 {% endif %}
+
+{% if enable_grafana | bool %}
+[cors]
+allowed_origin = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ grafana_server_port }}
+{% endif %}
-- 
GitLab