~raharper/charms/precise/swift-proxy/unique-get-zone

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/host.py

  • Committer: james.page at ubuntu
  • Date: 2014-05-21 10:08:22 UTC
  • mfrom: (26.1.1 swift-storage)
  • Revision ID: james.page@ubuntu.com-20140521100822-qo49z5e1pron2xv8
[tribaal,r=james-page,t=james-page]

Resync helpers to pickup fixes for apt lock races and better block device detection and handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import string
13
13
import subprocess
14
14
import hashlib
 
15
import apt_pkg
15
16
 
16
17
from collections import OrderedDict
17
18
 
295
296
    if 'link/ether' in words:
296
297
        hwaddr = words[words.index('link/ether') + 1]
297
298
    return hwaddr
 
299
 
 
300
 
 
301
def cmp_pkgrevno(package, revno, pkgcache=None):
 
302
    '''Compare supplied revno with the revno of the installed package
 
303
       1 => Installed revno is greater than supplied arg
 
304
       0 => Installed revno is the same as supplied arg
 
305
      -1 => Installed revno is less than supplied arg
 
306
    '''
 
307
    if not pkgcache:
 
308
        apt_pkg.init()
 
309
        pkgcache = apt_pkg.Cache()
 
310
    pkg = pkgcache[package]
 
311
    return apt_pkg.version_compare(pkg.current_ver.ver_str, revno)