~pmcgarry/ceph/ceph-osd

« back to all changes in this revision

Viewing changes to hooks/utils.py

  • Committer: Patrick McGarry
  • Date: 2013-02-16 00:24:27 UTC
  • Revision ID: patrick@inktank.com-20130216002427-3kq9frv6mrz8wikk
tweak to ceph repo key mgmt

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
        pocket = source.split(':')[1]
81
81
        with open('/etc/apt/sources.list.d/cloud-archive.list', 'w') as apt:
82
82
            apt.write(CLOUD_ARCHIVE.format(pocket))
83
 
    if source.startswith('http:'):
84
 
        if source.startswith('http://ceph.com'):
85
 
            with open('/etc/apt/sources.list.d/ceph.list', 'w') as apt:
86
 
                apt.write("deb " + source + "\n")
 
83
    if source.startswith('http:') and not source.startswith('http://ceph.com'):
 
84
        with open('/etc/apt/sources.list.d/ceph.list', 'w') as apt:
 
85
            apt.write("deb " + source + "\n")
 
86
        key = config_get('key')
 
87
        if key:
87
88
            cmd = [
88
 
                'wget',
89
 
                '-q',
90
 
                '-O-',
91
 
                "'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc'",
92
 
                '|',
93
89
                'apt-key',
94
 
                'add',
95
 
                '-'
 
90
                'adv', '--keyserver keyserver.ubuntu.com',
 
91
                '--recv-keys', key
96
92
                ]
97
93
            subprocess.check_call(cmd)
98
 
        else:
99
 
            with open('/etc/apt/sources.list.d/ceph.list', 'w') as apt:
100
 
                apt.write("deb " + source + "\n")
101
 
            key = config_get('key')
102
 
            if key:
103
 
                cmd = [
104
 
                    'apt-key',
105
 
                    'adv', '--keyserver keyserver.ubuntu.com',
106
 
                    '--recv-keys', key
107
 
                    ]
108
 
                subprocess.check_call(cmd)
 
94
    if source.startswith('http://ceph.com'):
 
95
        with open('/etc/apt/sources.list.d/ceph.list', 'w') as apt:
 
96
            apt.write("deb " + source + "\n")
 
97
        subprocess.check_call(["wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudo apt-key add -"], shell=True)
 
98
    cmd = [
 
99
        'apt-get',
 
100
        'update'
 
101
        ]
 
102
    subprocess.check_call(cmd)
 
103
 
109
104
 
110
105
def enable_pocket(pocket):
111
106
    apt_sources = "/etc/apt/sources.list"