From 2a31ed53e3343187091661aa4297719a50beb08c Mon Sep 17 00:00:00 2001 From: Nathan Gillett Date: Tue, 6 Aug 2024 14:55:14 -0500 Subject: [PATCH] Await dir availability while iterating StagedSource [RHELDST-25394] scandir in `_push_items_for_topdir` was reporting path strings as invalid arguments, presumably because they weren't yet available on the OCP environment. This commit places a `wait_exist` call on the path before doing anything with it. At the very least, we will now be warned if a path is inaccessible prior to failure. --- src/pushsource/_impl/backend/staged/staged_source.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pushsource/_impl/backend/staged/staged_source.py b/src/pushsource/_impl/backend/staged/staged_source.py index a5662d44..300bfdfe 100644 --- a/src/pushsource/_impl/backend/staged/staged_source.py +++ b/src/pushsource/_impl/backend/staged/staged_source.py @@ -12,7 +12,7 @@ from ...source import Source from ...model import DirectoryPushItem -from ...helpers import list_argument, as_completed_with_timeout_reset +from ...helpers import list_argument, as_completed_with_timeout_reset, wait_exist from .staged_utils import StagingMetadata, StagingLeafDir from .staged_ami import StagedAmiMixin @@ -134,6 +134,11 @@ def _push_items_for_leafdir(self, leafdir, metadata): def _push_items_for_topdir(self, topdir): LOG.info("Checking files in: %s", topdir) + # wait for path availability + timeout = int(os.getenv("PUSHSOURCE_SRC_POLL_TIMEOUT") or "0") + poll_rate = int(os.getenv("PUSHSOURCE_SRC_POLL_RATE") or "30") + wait_exist(topdir, timeout, poll_rate) + metadata = self._load_metadata(topdir) destdirs = []