Enable CORS for app-catalog

This commit enables the apache headers module,
and adds an access control header which will
allow AJAX requests from other sites. This
is intended to allow a Horizon panel to work
with the App Catalog directly. For multiple
deployments of OpenStack to access the JSON
files regardless of their domain name, this
additional header (Access-Control-Allow-Origin)
must be set to "*" which will enable cross-
origin resource sharing which is normally
forbidden to prevent security issues related
to cross-site scripting.

This commit also includes a modification to
the puppet module to create three JSON files from
the contents of YAML files retrieved from the
App Catalog repository. The YAML format was
chosen in order to make it convenient for humans
to add content to the App Catalog, but the
preliminary work on a Horizon plugin relies on
retrieving the contents in JSON format. Adding
the functionality to automatically generate
the JSON files is a short term step intended
to accelerate development of the Horizon plugin.

Change-Id: I4a3c44bb5806362416b1b175d917939ebaa351dd
Closes-Bug: 1467699
This commit is contained in:
Christopher Aedo 2015-06-23 16:36:48 -07:00
parent 38e49e9efc
commit 69c64a34be
2 changed files with 35 additions and 0 deletions

View File

@ -34,4 +34,36 @@ class apps_site (
vhost_name => $vhost_name,
}
a2mod { 'headers':
ensure => present
}
if ! defined(Package['python-yaml']) {
package { 'python-yaml':
ensure => present,
}
}
exec { 'make_glance_json' :
command => "python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout)' < ${root_dir}/openstack_catalog/web/static/glance_images.yaml > ${root_dir}/openstack_catalog/web/static/glance_images.json",
path => '/usr/local/bin:/usr/bin:/bin',
refreshonly => true,
subscribe => Vcsrepo[$root_dir],
}
exec { 'make_heat_json' :
command => "python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout)' < ${root_dir}/openstack_catalog/web/static/heat_templates.yaml > ${root_dir}/openstack_catalog/web/static/heat_templates.json",
path => '/usr/local/bin:/usr/bin:/bin',
refreshonly => true,
subscribe => Vcsrepo[$root_dir],
}
exec { 'make_murano_json' :
command => "python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout)' < ${root_dir}/openstack_catalog/web/static/murano_apps.yaml > ${root_dir}/openstack_catalog/web/static/murano_apps.json",
path => '/usr/local/bin:/usr/bin:/bin',
refreshonly => true,
subscribe => Vcsrepo[$root_dir],
}
}

View File

@ -11,6 +11,9 @@
Allow from all
Satisfy Any
</Directory>
<Directory <%= @docroot %>/static/>
Header set Access-Control-Allow-Origin "*"
</Directory>
ErrorLog /var/log/apache2/app_site-error.log