Add configure-devstack task for devstack gate

This patch adds 'configure-devstack' task to enable CORS headers in
keystone before functional-test are run.
No 'ini' library was used as I didn't find any supporting section
syntax "[[post-config|$KEYSTONE_CONF]]"

Change-Id: I7f335bbba3a768387a7d77916df019ba46e5519f
This commit is contained in:
Corentin Ardeois 2016-08-05 18:09:41 -04:00
parent 8ffc34d55e
commit 327dceee2b
2 changed files with 18 additions and 0 deletions

17
configure-devstack.js Normal file
View File

@ -0,0 +1,17 @@
/*eslint no-process-env: "off" */
import fs from 'fs';
import karma from 'karma/lib/config';
import path from 'path';
function getDevstackConfig() {
const karmaConfig = karma.parseConfig(path.resolve('./karma.conf.js'));
return "[[post-config|$KEYSTONE_CONF]]\n" +
"[cors]\n" +
"allowed_origin=http://localhost:" + karmaConfig.port + "\n";
}
fs.appendFile(process.env.BASE + '/new/devstack/local.conf', getDevstackConfig(), (err) => {
if (err) {
throw err;
}
});

View File

@ -4,6 +4,7 @@
"description": "JavaScript API library for OpenStack.",
"main": "dist/index.js",
"scripts": {
"configure-devstack": "babel-node ./configure-devstack.js",
"test": "npm run test:node; npm run test:browser",
"test:node": "istanbul cover jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"test:browser": "karma start",