Merge lp:~james-page/charm-helpers/fix-apt-race into lp:charm-helpers

Proposed by James Page
Status: Merged
Merged at revision: 181
Proposed branch: lp:~james-page/charm-helpers/fix-apt-race
Merge into: lp:charm-helpers
Diff against target: 14 lines (+4/-0)
1 file modified
charmhelpers/core/host.py (+4/-0)
To merge this branch: bzr merge lp:~james-page/charm-helpers/fix-apt-race
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+227894@code.launchpad.net

Description of the change

Fixup apt race

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/core/host.py'
2--- charmhelpers/core/host.py 2014-06-26 13:42:36 +0000
3+++ charmhelpers/core/host.py 2014-07-23 11:19:58 +0000
4@@ -322,6 +322,10 @@
5 import apt_pkg
6 if not pkgcache:
7 apt_pkg.init()
8+ # Force Apt to build its cache in memory. That way we avoid race
9+ # conditions with other applications building the cache in the same
10+ # place.
11+ apt_pkg.config.set("Dir::Cache::pkgcache", "")
12 pkgcache = apt_pkg.Cache()
13 pkg = pkgcache[package]
14 return apt_pkg.version_compare(pkg.current_ver.ver_str, revno)

Subscribers

People subscribed via source and target branches