Browse Source

Don't error if clouds.yaml is not readable

There is a search path that we should check the next file if the first
file we find is not readable.

Change-Id: Ib638fe74210257f9175e28c1ccfff4493ef32873
Story: 2007645
Task: 39704
(cherry picked from commit d8be0e94d4b78c6fd4dd25888cffe113641f4176)
tags/0.36.4^0
Alex Schultz 2 months ago
committed by Emilien Macchi
parent
commit
76d3b292b4
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      openstack/config/loader.py

+ 12
- 5
openstack/config/loader.py View File

@@ -17,6 +17,7 @@
import argparse as argparse_mod
import collections
import copy
import errno
import json
import os
import re
@@ -378,11 +379,17 @@ class OpenStackConfig(object):
def _load_yaml_json_file(self, filelist):
for path in filelist:
if os.path.exists(path):
with open(path, 'r') as f:
if path.endswith('json'):
return path, json.load(f)
else:
return path, yaml.safe_load(f)
try:
with open(path, 'r') as f:
if path.endswith('json'):
return path, json.load(f)
else:
return path, yaml.safe_load(f)
except IOError as e:
if e.errno == errno.EACCES:
# Can't access file so let's continue to the next
# file
continue
return (None, {})

def _expand_region_name(self, region_name):


Loading…
Cancel
Save