~corey.bryant/charms/trusty/swift-proxy/use-stable

« back to all changes in this revision

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

  • Committer: Liam Young
  • Date: 2014-08-26 13:30:43 UTC
  • Revision ID: liam.young@canonical.com-20140826133043-sm2mts2dqn67p5f7
Sync charm helpers

Show diffs side-by-side

added added

removed removed

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