Skip to content

Instantly share code, notes, and snippets.

@r0x0d
Created May 2, 2024 17:22
Show Gist options
  • Save r0x0d/45e346989d17de71a9c35c44febf3e66 to your computer and use it in GitHub Desktop.
Save r0x0d/45e346989d17de71a9c35c44febf3e66 to your computer and use it in GitHub Desktop.
diff --git a/convert2rhel/backup/packages.py b/convert2rhel/backup/packages.py
index 47f70c5b..df69b361 100644
--- a/convert2rhel/backup/packages.py
+++ b/convert2rhel/backup/packages.py
@@ -136,10 +136,10 @@ class RestorablePackage(RestorableChange):
loggerinst.info("Backing up the packages: %s." % ",".join(self.pkgs))
loggerinst.debug("Using repository files stored in %s." % self.reposdir)
- if self.reposdir:
+ if self.reposdir and os.path.exists(self.reposdir):
# If nothing is inside the directory, or it does not exist, let's
# just not use it to download the packages.
- if len(os.listdir(self.reposdir)) == 0 or not os.path.exists(self.reposdir):
+ if len(os.listdir(self.reposdir)) == 0:
loggerinst.info("The repository directory %s seems to be empty or non-existent.")
self.reposdir = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment