Skip to content

Commit 334bf71

Browse files
committed
checking for offline done with self._trusted_set.offline
1 parent 17b03d5 commit 334bf71

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tuf/ngclient/updater.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def refresh(self) -> None:
131131
DownloadError: Download of a metadata file failed in some way
132132
"""
133133

134-
if self.config.offline:
134+
if self._trusted_set.offline:
135135
# Try loading only local data
136136
data = self._load_local_metadata(Timestamp.type)
137137
self._trusted_set.update_timestamp(data)
@@ -243,7 +243,7 @@ def download_target(
243243
Local path to downloaded file
244244
"""
245245

246-
if self.config.offline:
246+
if self._trusted_set.offline:
247247
raise RuntimeError("Cannot download when offline")
248248

249249
if filepath is None:
@@ -403,8 +403,8 @@ def _load_targets(self, role: str, parent_role: str) -> Metadata[Targets]:
403403
logger.debug("Local %s is valid: not downloading new one", role)
404404
return delegated_targets
405405
except (OSError, exceptions.RepositoryError) as e:
406-
# fails if local data is unavalible and in offline mode
407-
if self.config.offline:
406+
# fail if local data is unavailable and in offline mode
407+
if self._trusted_set.offline:
408408
raise exceptions.DownloadError("Local metadata is missing; cannot download new metadata in offline mode")
409409
# Local 'role' does not exist or is invalid: update from remote
410410
logger.debug("Failed to load local %s: %s", role, e)

0 commit comments

Comments
 (0)