~pmcgarry/ceph/ceph

« back to all changes in this revision

Viewing changes to hooks/utils.py

  • Committer: James Page
  • Date: 2012-10-18 08:24:36 UTC
  • mfrom: (48.1.3 ceph)
  • Revision ID: james.page@canonical.com-20121018082436-g780tz6coav8hhvl
Merged changes from pjdc including cephx configuration support and better arbitarty repository handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
def configure_source():
54
54
    source = config_get('source')
55
55
    if (source.startswith('ppa:') or
56
 
        source.startswith('cloud:') or
57
 
        source.startswith('http:')):
 
56
        source.startswith('cloud:')):
58
57
        cmd = [
59
58
            'add-apt-repository',
60
59
            source
61
60
            ]
62
61
        subprocess.check_call(cmd)
63
62
    if source.startswith('http:'):
 
63
        with open('/etc/apt/sources.list.d/ceph.list', 'w') as apt:
 
64
            apt.write("deb " + source + "\n")
64
65
        key = config_get('key')
65
 
        cmd = [
66
 
            'apt-key',
67
 
            'import',
68
 
            key
69
 
            ]
70
 
        subprocess.check_call(cmd)
 
66
        if key != "":
 
67
            cmd = [
 
68
                'apt-key',
 
69
                'import',
 
70
                key
 
71
                ]
 
72
            subprocess.check_call(cmd)
71
73
    cmd = [
72
74
        'apt-get',
73
75
        'update'