Compare commits
2 Commits
d9747380f2
...
f8d587275b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d587275b | ||
|
|
a717cab182 |
@ -74,15 +74,14 @@ def run_batch(
|
||||
try:
|
||||
ensure_dir_exists(input_dir, samba_conn)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
return BatchResult(
|
||||
status="error",
|
||||
processed=0,
|
||||
partial=0,
|
||||
errors=1,
|
||||
report_path="",
|
||||
protocol_path="",
|
||||
log_path="",
|
||||
messages=[f"Не удалось создать входную папку: {input_dir}. {exc}"],
|
||||
return _build_input_dir_error_result(
|
||||
input_dir=input_dir,
|
||||
details=str(exc),
|
||||
)
|
||||
if not samba_conn.path_exists(input_dir):
|
||||
return _build_input_dir_error_result(
|
||||
input_dir=input_dir,
|
||||
details="Проверьте права на родительский каталог.",
|
||||
)
|
||||
is_ok, access_error = check_input_dir_access(
|
||||
input_dir=input_dir, samba_conn=samba_conn
|
||||
@ -449,3 +448,16 @@ def _format_duration(duration_seconds: float) -> str:
|
||||
if minutes:
|
||||
return f"{minutes} мин {seconds} сек"
|
||||
return f"{seconds} сек"
|
||||
|
||||
|
||||
def _build_input_dir_error_result(input_dir: str, details: str) -> BatchResult:
|
||||
return BatchResult(
|
||||
status="error",
|
||||
processed=0,
|
||||
partial=0,
|
||||
errors=1,
|
||||
report_path="",
|
||||
protocol_path="",
|
||||
log_path="",
|
||||
messages=[f"Не удалось создать входную папку: {input_dir}. {details}"],
|
||||
)
|
||||
|
||||
@ -35,6 +35,15 @@ def check_access_and_list_files(
|
||||
ensure_dir_exists(input_dir, samba_conn=samba_conn)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
return False, f"Не удалось создать входную папку: {input_dir}. {exc}", []
|
||||
if not samba_conn.path_exists(input_dir):
|
||||
return (
|
||||
False,
|
||||
(
|
||||
"Не удалось создать входную папку: "
|
||||
f"{input_dir}. Проверьте права на родительский каталог."
|
||||
),
|
||||
[],
|
||||
)
|
||||
|
||||
ok, error = check_input_dir_access(Path(input_dir), samba_conn=samba_conn)
|
||||
if not ok:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user