
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
24 lines
485 B
JavaScript
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';
|
|
|