From 88a5b49795ad2d9a28cba739437181a8fec6d770 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Wed, 25 Apr 2018 10:32:21 -0400 Subject: [PATCH] new-updates-sync: allow for just syncing ostrees Previously it was not able to sync just an ostree and not a repo (i.e. an empty to: [], like we have right now for f28). --- roles/bodhi2/backend/files/new-updates-sync | 29 ++++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/roles/bodhi2/backend/files/new-updates-sync b/roles/bodhi2/backend/files/new-updates-sync index b392def49b..de6dca78c7 100755 --- a/roles/bodhi2/backend/files/new-updates-sync +++ b/roles/bodhi2/backend/files/new-updates-sync @@ -311,20 +311,23 @@ def sync_single_release(release): for repo in RELEASES[release]['repos']: target = determine_last_link(release, repo) - curstatefile = os.path.join( - RELEASES[release]['repos'][repo]['to'][0]['dest'], 'state') - curstate = None - if os.path.exists(curstatefile): - with open(curstatefile, 'r') as f: - curstate = f.read().split()[0] - if curstate and curstate == target: - logger.info('This repo has already been synced') - else: - sync_single_repo(release, repo) - with open(curstatefile, 'w') as f: - f.write(target) - needssync = True + # if "to" is not empty then sync repo + if RELEASES[release]['repos'][repo]['to']: + curstatefile = os.path.join( + RELEASES[release]['repos'][repo]['to'][0]['dest'], 'state') + curstate = None + if os.path.exists(curstatefile): + with open(curstatefile, 'r') as f: + curstate = f.read().split()[0] + + if curstate and curstate == target: + logger.info('This repo has already been synced') + else: + sync_single_repo(release, repo) + with open(curstatefile, 'w') as f: + f.write(target) + needssync = True for ostree in RELEASES[release]['repos'][repo].get('ostrees', []): pairs = []