Skip to content

Commit 24240d9

Browse files
authored
fix(minio): run MinIO upload even when no files are missing from ownCloud (#14)
1 parent c163497 commit 24240d9

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

main.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def daterange(start_date, end_date) -> list[datetime]:
3030

3131
@cache
3232
def oc_mkdir(oc: OwnCloudClient, path: str) -> bool:
33-
print(path)
3433
try:
3534
return oc.mkdir(path)
3635
except OCResponseError as ex: # pragma: no cover
@@ -289,19 +288,17 @@ def main(): # pragma: no cover
289288
oc.login(options.oc_user, options.oc_pass)
290289
missing = oc_check(oc=oc, oc_path=options.oc_path)
291290

292-
# return early if no files are missing
293-
if not missing:
294-
return
291+
if missing:
292+
# fetch and store missing data
293+
oc_fetch(
294+
missing,
295+
acr=acr_client,
296+
oc=oc,
297+
acr_project_id=options.acr_project_id,
298+
acr_stream_id=options.acr_stream_id,
299+
oc_path=options.oc_path,
300+
)
295301

296-
# fetch and store missing data
297-
oc_fetch(
298-
missing,
299-
acr=acr_client,
300-
oc=oc,
301-
acr_project_id=options.acr_project_id,
302-
acr_stream_id=options.acr_stream_id,
303-
oc_path=options.oc_path,
304-
)
305302
if options.minio:
306303
mc = Minio(
307304
options.minio_url,
@@ -316,19 +313,16 @@ def main(): # pragma: no cover
316313
mc.make_bucket(options.minio_bucket)
317314
missing = mc_check(mc=mc, bucket=options.minio_bucket)
318315

319-
# return early if no files are missing
320-
if not missing:
321-
return
322-
323-
# fetch and store missing data
324-
mc_fetch(
325-
missing,
326-
acr=acr_client,
327-
mc=mc,
328-
acr_project_id=options.acr_project_id,
329-
acr_stream_id=options.acr_stream_id,
330-
bucket=options.minio_bucket,
331-
)
316+
if missing:
317+
# fetch and store missing data
318+
mc_fetch(
319+
missing,
320+
acr=acr_client,
321+
mc=mc,
322+
acr_project_id=options.acr_project_id,
323+
acr_stream_id=options.acr_stream_id,
324+
bucket=options.minio_bucket,
325+
)
332326

333327

334328
if __name__ == "__main__": # pragma: no cover

0 commit comments

Comments
 (0)