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 d8be0e94d4
)
This commit is contained in:
parent
c07350e68a
commit
76d3b292b4
|
@ -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…
Reference in New Issue