The error message shown when the parser finds a parser error
says, 'file not found' which causes confusion on the user when
he/she needs to debug the real cause o the problem. This patch fix
this by testing first if the file exist and then throwing a
proper error message.
Closes-Bug: #
1402775
Change-Id: I91c7a24d5da37735787e8fc0da544c8ba8204884
:param xml_config_file: string filename containing XML configuration
"""
+ if not os.access(xml_config_file, os.R_OK):
+ raise exception.NotFound(message=_LE('Can\'t open config file: ')
+ + xml_config_file)
+
try:
root = ETree.parse(xml_config_file).getroot()
except Exception:
- raise exception.NotFound(message='config file not found: '
- + xml_config_file)
+ raise exception.ConfigNotFound(
+ message=_LE('Error parsing config file: ') + xml_config_file)
# mandatory parameters
config = {}