~tribaal/charms/raring/ceph/add-python-ceph-charm

« back to all changes in this revision

Viewing changes to hooks/ceph.py

  • Committer: James Page
  • Date: 2012-12-17 10:22:51 UTC
  • Revision ID: james.page@canonical.com-20121217102251-xps6cjcygkzxnohf
Updates for latest ceph upstream and utils refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import time
13
13
import utils
14
14
import os
 
15
import apt_pkg as apt
15
16
 
16
17
LEADER = 'leader'
17
18
PEON = 'peon'
207
208
            if 'key' in element:
208
209
                key = element.split(' = ')[1].strip()  # IGNORE:E1103
209
210
    return key
 
211
 
 
212
 
 
213
def get_ceph_version():
 
214
    apt.init()
 
215
    cache = apt.Cache()
 
216
    pkg = cache['ceph']
 
217
    if pkg.current_ver:
 
218
        return apt.upstream_version(pkg.current_ver.ver_str)
 
219
    else:
 
220
        return None
 
221
 
 
222
 
 
223
def version_compare(a, b):
 
224
    return apt.version_compare(a, b)