Re: FBR: Make new-updates-sync resync on re-stage without need for state deletion
+1 On Sun, Apr 29, 2018, 12:15 Kevin Fenziwrote: > +1 > > kevin > > ___ > infrastructure mailing list -- infrastructure@lists.fedoraproject.org > To unsubscribe send an email to > infrastructure-le...@lists.fedoraproject.org > ___ infrastructure mailing list -- infrastructure@lists.fedoraproject.org To unsubscribe send an email to infrastructure-le...@lists.fedoraproject.org
Re: FBR: Make new-updates-sync resync on re-stage without need for state deletion
+1 kevin signature.asc Description: OpenPGP digital signature ___ infrastructure mailing list -- infrastructure@lists.fedoraproject.org To unsubscribe send an email to infrastructure-le...@lists.fedoraproject.org
Re: FBR: Make new-updates-sync resync on re-stage without need for state deletion
LGTM +1 On Sun, Apr 29, 2018 at 9:44 AM Patrick マルタインアンドレアス Uiterwijk < puiterw...@redhat.com> wrote: > Hi, > > So, for now (until https://github.com/fedora-infra/bodhi/pull/1986 gets > finished and merged), it might happen that Bodhi stages a repo a second > time (if it crashed while waiting for sync), which new-updates-sync doesn't > notice, meaning releng needs to manually clean up the state file. > This patch should make new-updates-sync detect this case and force a > resync. > Can I get +1s? > > Patrick > > > diff --git a/roles/bodhi2/backend/files/new-updates-sync > b/roles/bodhi2/backend/files/new-updates-sync > index fba2a3d27..df59cd421 100755 > --- a/roles/bodhi2/backend/files/new-updates-sync > +++ b/roles/bodhi2/backend/files/new-updates-sync > @@ -328,6 +328,28 @@ def sync_single_release(release): > with open(curstatefile, 'r') as f: > curstate = f.read().split()[0] > > +# Resync if Bodhi failed out during the sync waiting, which > leads > +# to changed repomd.xml without an updated repo. > +# (updateinfo is inserted again) > +# Fix: https://github.com/fedora-infra/bodhi/pull/1986 > +if curstate and curstate == target: > +curstatestat = os.stat(curstatefile) > +repostat = os.stat(os.path.join( > +target, 'compose', 'Everything', > + > RELEASES[release]['repos'][repo]['to'][0]['arches'][0], > +'os', 'repodata', 'repomd.xml')) > +if curstatestat[stat.ST_MTIME] < repostat[stat.ST_MTIME]: > +# If the curstate file has an earlier mtime than the > repomd > +# of the first architecture, this repo was > re-generated > +# after the first time it got staged. Resync. > +logger.error( > +'Re-stage detected of %s %s. ' > +'State mtime: %s, repo mtime: %s', > +release, repo, > +curstatestat[stat.ST_MTIME], > +repostat[stat.ST_MTIME]) > +curstate = None > + > if curstate and curstate == target: > logger.info('This repo has already been synced') > else: > ___ > infrastructure mailing list -- infrastructure@lists.fedoraproject.org > To unsubscribe send an email to > infrastructure-le...@lists.fedoraproject.org > ___ infrastructure mailing list -- infrastructure@lists.fedoraproject.org To unsubscribe send an email to infrastructure-le...@lists.fedoraproject.org
FBR: Make new-updates-sync resync on re-stage without need for state deletion
Hi, So, for now (until https://github.com/fedora-infra/bodhi/pull/1986 gets finished and merged), it might happen that Bodhi stages a repo a second time (if it crashed while waiting for sync), which new-updates-sync doesn't notice, meaning releng needs to manually clean up the state file. This patch should make new-updates-sync detect this case and force a resync. Can I get +1s? Patrick diff --git a/roles/bodhi2/backend/files/new-updates-sync b/roles/bodhi2/backend/files/new-updates-sync index fba2a3d27..df59cd421 100755 --- a/roles/bodhi2/backend/files/new-updates-sync +++ b/roles/bodhi2/backend/files/new-updates-sync @@ -328,6 +328,28 @@ def sync_single_release(release): with open(curstatefile, 'r') as f: curstate = f.read().split()[0] +# Resync if Bodhi failed out during the sync waiting, which leads +# to changed repomd.xml without an updated repo. +# (updateinfo is inserted again) +# Fix: https://github.com/fedora-infra/bodhi/pull/1986 +if curstate and curstate == target: +curstatestat = os.stat(curstatefile) +repostat = os.stat(os.path.join( +target, 'compose', 'Everything', +RELEASES[release]['repos'][repo]['to'][0]['arches'][0], +'os', 'repodata', 'repomd.xml')) +if curstatestat[stat.ST_MTIME] < repostat[stat.ST_MTIME]: +# If the curstate file has an earlier mtime than the repomd +# of the first architecture, this repo was re-generated +# after the first time it got staged. Resync. +logger.error( +'Re-stage detected of %s %s. ' +'State mtime: %s, repo mtime: %s', +release, repo, +curstatestat[stat.ST_MTIME], +repostat[stat.ST_MTIME]) +curstate = None + if curstate and curstate == target: logger.info('This repo has already been synced') else: ___ infrastructure mailing list -- infrastructure@lists.fedoraproject.org To unsubscribe send an email to infrastructure-le...@lists.fedoraproject.org