Files
js-openstack-lib/test/functional/helpers/cloudsYamlPath.js
Vitaly Kramskikh 348b5927e6 Update eslint and eslint-config-openstack to latest versions
The newest eslint-config-openstack provides all the
ES2015-related extra rules we had in the local .eslintrc,
so that they can be removed.

Also, cloudsYamlPath.js was modified to adapt to
`keyword-spacing` rule modifications in eslint v3.

Change-Id: I55198a323a0ada7a74f425d21db42306d9548cb7
2016-08-10 17:44:02 +03:00

24 lines
485 B
JavaScript

/*eslint no-process-env: "off", no-sync: "off"*/
import fs from 'fs';
import path from 'path';
const resolvePaths = [
'./clouds.yaml',
process.env.HOME + '/.config/openstack/clouds.yaml',
'/etc/openstack/clouds.yaml'
];
function fileExists(path) {
try {
fs.statSync(path);
return true;
} catch (err) {
return false;
}
}
const cloudFiles = resolvePaths.filter(fileExists);
export default cloudFiles.length > 0 ? path.resolve(cloudFiles[0]) : 'clouds.yaml';