Skip to content

Check for metadata changes when building an image#479

Merged
bcl merged 4 commits intoweldr:rhel7-extrasfrom
bcl:extras-rhel7-1632962
Oct 1, 2018
Merged

Check for metadata changes when building an image#479
bcl merged 4 commits intoweldr:rhel7-extrasfrom
bcl:extras-rhel7-1632962

Conversation

@bcl
Copy link
Contributor

@bcl bcl commented Sep 27, 2018

Keeping the metadata in sync is more tricky than you would expect. Add a
test that makes sure that changing the repo contents is picked up after
the short (10s) expiration timeout, and another to test that a new
package is picked up when starting a new build.

This depends on rpmfluff which is available from Fedora or EPEL repos.

Related: rhbz#1628114

@coveralls
Copy link

coveralls commented Sep 27, 2018

Pull Request Test Coverage Report for Build 658

  • 60 of 63 (95.24%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 43.794%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/pylorax/api/projects.py 21 22 95.45%
src/pylorax/api/yumbase.py 38 40 95.0%
Totals Coverage Status
Change from base Build 656: 0.4%
Covered Lines: 2387
Relevant Lines: 5023

💛 - Coveralls

@bcl bcl force-pushed the extras-rhel7-1632962 branch from 97ee13f to b7de690 Compare September 27, 2018 17:32
@bcl bcl changed the title Add a test for repo metadata expiration Update repo metadata when it changes, or when building an image Sep 27, 2018
@bcl bcl changed the title Update repo metadata when it changes, or when building an image Check for metadata changes when building an image Sep 27, 2018
bcl added 4 commits October 1, 2018 11:09
Use a common _depsolve function for projects_depsolve and
projects_depsolve_with_size so that it always uses the correct version
glob support when depsolving blueprints and templates.

Resolves: rhbz#1628114
The problem this solves is that yum really isn't designed to be part of\
a long running daemon. So when repodata changes upstream, even when
you force it to download the new metadata, it doesn't change in memory
so you end up with lorax-composer depsolving against old versions, and
anaconda depsolving against new versions (because it sets up its own
YumBase and cache) and then the kickstart is no longer valid.

To solve this I have
 - Added a 6h timeout to the metadata check (because yum's doesn't work
   in this situation).
 - Added a metadata check to the YumLock .lock property, but only when
   the timeout expires.
 - Added a new .lock_check property to YumLock that always checks the
   metadata and resets the timeout.

If it has changed it does its best to tear down the existing YumBase,
deleting as much as it can in hopes it doesn't leak memory. And then it
sets up a totally new YumBase with the new repodata.

Resolves: rhbz#1632962
This tests to make sure that the metadata timer is working (by setting
it to 10s and adding a new package to the repo), and that
YumLock.lock_check immediately picks up a new package.

This depends on rpmfluff which is available from Fedora or EPEL repos.

Related: rhbz#1632962
@bcl bcl force-pushed the extras-rhel7-1632962 branch from b7de690 to 0f130dd Compare October 1, 2018 20:38
@bcl bcl merged commit 0f130dd into weldr:rhel7-extras Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants