Skip to content

Commit

Permalink
Fix issue of comparing existing Servermodels with XML-files to import
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Beitler authored and oroulet committed Jan 12, 2021
1 parent b61724d commit cf278b5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions asyncua/common/xmlimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ async def _get_existing_model_in_namespace(self):
for model_node in server_namespaces_node:
server_model_list.append({"ModelUri": await(await model_node.get_child("NamespaceUri")).read_value(),
"Version": await(await model_node.get_child("NamespaceVersion")).read_value(),
"PublicationDate": str(await(
await model_node.get_child("NamespacePublicationDate")).read_value())})
"PublicationDate": (await(
await model_node.get_child("NamespacePublicationDate")).
read_value()).strftime("%Y-%m-%dT%H:%M:%SZ")})
return server_model_list

async def _check_required_models(self, xmlpath=None, xmlstring=None):
Expand All @@ -75,8 +76,9 @@ async def _check_required_models(self, xmlpath=None, xmlstring=None):
else:
req_models.remove(req_model)
if len(req_models):
for missing_model in server_model_list:
_logger.warning("Model is missing: ", missing_model)
for missing_model in req_models:
_logger.warning("Model is missing: %s - Version: %s - PublicationDate: %s or newer",
missing_model["ModelUri"], missing_model["Version"], missing_model["PublicationDate"])
raise ValueError("Server doesn't satisfy required XML-Models. Import them first!")
return None

Expand Down

0 comments on commit cf278b5

Please sign in to comment.