Skip to content
Snippets Groups Projects
Commit d5ea5d5d authored by Ugo Albanese's avatar Ugo Albanese
Browse files

[NRRPLT-0000][HOTFIX] Fix error message on model.config validation error.

parent b19366f2
No related branches found
No related tags found
No related merge requests found
...@@ -258,6 +258,7 @@ class RobotCallHandler(object): ...@@ -258,6 +258,7 @@ class RobotCallHandler(object):
:return: Tuple (True, extracted SDF absolute path) or (False, error message) :return: Tuple (True, extracted SDF absolute path) or (False, error message)
""" """
try: try:
robot = Model(robot_model, ResourceType.ROBOT) robot = Model(robot_model, ResourceType.ROBOT)
data = self._client.get_model( data = self._client.get_model(
self._cle_assembly.sim_config.token, self._cle_assembly.sim_config.token,
...@@ -286,7 +287,6 @@ class RobotCallHandler(object): ...@@ -286,7 +287,6 @@ class RobotCallHandler(object):
return False, "'model.config' has no 'sdf' tag" return False, "'model.config' has no 'sdf' tag"
sdf_filename = os.path.basename(sdf_abs_path) sdf_filename = os.path.basename(sdf_abs_path)
if not os.path.isfile(sdf_abs_path): if not os.path.isfile(sdf_abs_path):
return False, "No SDF named {name} found at {loc} specified " \ return False, "No SDF named {name} found at {loc} specified " \
"in model.config in the uploaded zip" \ "in model.config in the uploaded zip" \
...@@ -309,16 +309,20 @@ class RobotCallHandler(object): ...@@ -309,16 +309,20 @@ class RobotCallHandler(object):
# pylint: disable=no-self-use # pylint: disable=no-self-use
# Get robot sdf name from model.config # Get robot sdf name from model.config
with open(model_config_abs_path) as conf: with open(model_config_abs_path) as conf:
model_config_abs_path_dir = os.path.dirname(model_config_abs_path)
try: try:
confDOM = robotXmlParser.CreateFromDocument(conf.read()) confDOM = robotXmlParser.CreateFromDocument(conf.read())
except ValidationError as ve: except ValidationError as ve:
raise Exception("Could not parse experiment configuration {0:s} due " raise Exception("Could not parse {model_name:s} .config file due "
"to validation error: {1:s}".format(conf, str(ve))) "to validation error: {error:s}"
.format(error=str(ve),
model_name=os.path.basename(model_config_abs_path_dir)))
if confDOM.sdf is None: if confDOM.sdf is None:
return None return None
return os.path.join(os.path.dirname(model_config_abs_path), confDOM.sdf.value()) return os.path.join(model_config_abs_path_dir, confDOM.sdf.value())
def _customize_sdf(self, sdf_abs_path, robot_id): # pragma: no cover def _customize_sdf(self, sdf_abs_path, robot_id): # pragma: no cover
""" """
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment