Skip to content

Commit

Permalink
Reaarrange repo loop
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-watson committed Apr 16, 2024
1 parent 0852e29 commit 9d8093f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions convert2rhel/actions/pre_ponr_changes/backup_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ def backup_yum_repos(self):
repo_files_backed_up = False
for repo in os.listdir(DEFAULT_YUM_REPOFILE_DIR):
# backing up redhat.repo so repo files are properly backed up when doing satellite conversions
if (repo.endswith(".repo") and repo != "redhat.repo") or (
subscription.should_subscribe and repo == "redhat.repo"
):
repo_path = os.path.join(DEFAULT_YUM_REPOFILE_DIR, repo)
restorable_file = RestorableFile(repo_path)
backup.backup_control.push(restorable_file)
repo_files_backed_up = True

if not repo.endswith(".repo"):
return

if not subscription.should_subscribe and repo == "redhat.repo":
return

repo_path = os.path.join(DEFAULT_YUM_REPOFILE_DIR, repo)
restorable_file = RestorableFile(repo_path)
backup.backup_control.push(restorable_file)
repo_files_backed_up = True

if not repo_files_backed_up:
loggerinst.info("No .repo files backed up.")
Expand Down

0 comments on commit 9d8093f

Please sign in to comment.