~bjornt/charms/trusty/quantum-gateway-hardcode-eth1/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/utils.py

  • Committer: Liam Young
  • Date: 2014-08-29 06:42:05 UTC
  • mfrom: (51.1.1 quantum-gateway)
  • Revision ID: liam.young@canonical.com-20140829064205-cdjx1ptz0ellm7lv
[gnuoy,r=tribaal] Resync charmhelpers for apt cache bug fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
)
25
25
 
26
26
from charmhelpers.core.host import lsb_release, mounts, umount
27
 
from charmhelpers.fetch import apt_install
 
27
from charmhelpers.fetch import apt_install, apt_cache
28
28
from charmhelpers.contrib.storage.linux.utils import is_block_device, zap_disk
29
29
from charmhelpers.contrib.storage.linux.loopback import ensure_loopback_device
30
30
 
130
130
 
131
131
def get_os_codename_package(package, fatal=True):
132
132
    '''Derive OpenStack release codename from an installed package.'''
133
 
    apt.init()
134
 
 
135
 
    # Tell apt to build an in-memory cache to prevent race conditions (if
136
 
    # another process is already building the cache).
137
 
    apt.config.set("Dir::Cache::pkgcache", "")
138
 
 
139
 
    cache = apt.Cache()
 
133
 
 
134
    cache = apt_cache()
140
135
 
141
136
    try:
142
137
        pkg = cache[package]