Skip to content

Commit

Permalink
Merge pull request #312 from DSD-DBS/fix-capella-7-importer
Browse files Browse the repository at this point in the history
fix: Consider changed success message for importer / exporter
  • Loading branch information
MoritzWeber0 authored Aug 16, 2024
2 parents b5b31b4 + 83ecfd2 commit 402ec5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions t4c/t4c_cli/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def _build_backup_command(


def _validate_backup_stdout(line: str) -> None:
if re.search(r"[1-9][0-9]* projects imports failed", line):
if re.search(r"[1-9][0-9]* projects? imports? failed", line):
raise RuntimeError("Backup failed. Please check the logs above.")
if re.search(r"[1-9][0-9]* archivings failed", line):
if re.search(r"[1-9][0-9]* archivings? failed", line):
raise RuntimeError(
f"Failed to create archives in output folder ({config.config.t4c.project_dir_path})"
)
Expand All @@ -99,13 +99,13 @@ def run_importer_script(
"'!MESSAGE [1-9][0-9]* Succeeded' not found in logs"
)
else:
if not re.search(r"[1-9][0-9]* projects imports succeeded", stdout):
if not re.search(r"[1-9][0-9]* projects? imports? succeeded", stdout):
raise RuntimeError(
"'[1-9][0-9]* projects imports succeeded' not found in logs"
"'[1-9][0-9]* projects? imports? succeeded' not found in logs"
)
if not re.search(r"[1-9][0-9]* archivings succeeded", stdout):
if not re.search(r"[1-9][0-9]* archivings? succeeded", stdout):
raise RuntimeError(
"'[1-9][0-9]* archivings succeeded' not found in logs"
"'[1-9][0-9]* archivings? succeeded' not found in logs"
)

log.info("Import of model from TeamForCapella server finished")
Expand Down
3 changes: 2 additions & 1 deletion t4c/t4c_cli/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os
import pathlib
import re
import shutil

import click
Expand Down Expand Up @@ -52,7 +53,7 @@ def _validate_exporter_stdout(line: str) -> None:
raise RuntimeError("Unknown host")
elif "No such user:" in line:
raise RuntimeError("Unknown user")
elif "1 projects exports failed" in line:
elif re.search(r"[1-9][0-9]* projects? exports? failed", line):
raise RuntimeError("Export failed")


Expand Down

0 comments on commit 402ec5e

Please sign in to comment.