Merged changes from pjdc including cephx configuration support and better arbitarty repository handling

This commit is contained in:
James Page 2012-10-18 09:24:36 +01:00
commit eeaafbafe9
6 changed files with 57 additions and 12 deletions

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ceph</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

10
.pydevproject Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/ceph/hooks</path>
</pydev_pathproperty>
</pydev_project>

View File

@ -6,6 +6,15 @@ options:
.
This configuration element is mandatory and the service will fail on
install if it is not provided.
auth-supported:
type: string
default: cephx
description: |
Which authentication flavour to use.
.
Valid options are "cephx" and "none". If "none" is specified,
keys will still be created and deployed so that it can be
enabled later.
monitor-secret:
type: string
description: |

View File

@ -33,6 +33,7 @@ def install():
def emit_cephconf():
cephcontext = {
'auth_supported': utils.config_get('auth-supported'),
'mon_hosts': ' '.join(get_mon_hosts()),
'fsid': utils.config_get('fsid'),
}
@ -166,6 +167,7 @@ def notify_osds():
for relid in utils.relation_ids('osd'):
utils.relation_set(fsid=utils.config_get('fsid'),
osd_bootstrap_key=ceph.get_osd_bootstrap_key(),
auth=utils.config_get('auth-supported'),
rid=relid)
utils.juju_log('INFO', 'End notify_osds.')
@ -176,6 +178,7 @@ def notify_radosgws():
for relid in utils.relation_ids('radosgw'):
utils.relation_set(radosgw_key=ceph.get_radosgw_key(),
auth=utils.config_get('auth-supported'),
rid=relid)
utils.juju_log('INFO', 'End notify_radosgws.')
@ -187,6 +190,7 @@ def notify_client():
for relid in utils.relation_ids('client'):
service_name = utils.relation_list(relid)[0].split('/')[0]
utils.relation_set(key=ceph.get_named_key(service_name),
auth=utils.config_get('auth-supported'),
rid=relid)
utils.juju_log('INFO', 'End notify_client.')
@ -199,7 +203,8 @@ def osd_relation():
utils.juju_log('INFO',
'mon cluster in quorum - providing fsid & keys')
utils.relation_set(fsid=utils.config_get('fsid'),
osd_bootstrap_key=ceph.get_osd_bootstrap_key())
osd_bootstrap_key=ceph.get_osd_bootstrap_key(),
auth=utils.config_get('auth-supported'))
else:
utils.juju_log('INFO',
'mon cluster not in quorum - deferring fsid provision')
@ -216,7 +221,8 @@ def radosgw_relation():
utils.juju_log('INFO',
'mon cluster in quorum - \
providing radosgw with keys')
utils.relation_set(radosgw_key=ceph.get_radosgw_key())
utils.relation_set(radosgw_key=ceph.get_radosgw_key(),
auth=utils.config_get('auth-supported'))
else:
utils.juju_log('INFO',
'mon cluster not in quorum - deferring key provision')
@ -232,7 +238,8 @@ def client_relation():
'mon cluster in quorum - \
providing client with keys')
service_name = os.environ['JUJU_REMOTE_UNIT'].split('/')[0]
utils.relation_set(key=ceph.get_named_key(service_name))
utils.relation_set(key=ceph.get_named_key(service_name),
auth=utils.config_get('auth-supported'))
else:
utils.juju_log('INFO',
'mon cluster not in quorum - deferring key provision')

View File

@ -53,21 +53,23 @@ def render_template(template_name, context, template_dir=TEMPLATES_DIR):
def configure_source():
source = config_get('source')
if (source.startswith('ppa:') or
source.startswith('cloud:') or
source.startswith('http:')):
source.startswith('cloud:')):
cmd = [
'add-apt-repository',
source
]
subprocess.check_call(cmd)
if source.startswith('http:'):
with open('/etc/apt/sources.list.d/ceph.list', 'w') as apt:
apt.write("deb " + source + "\n")
key = config_get('key')
cmd = [
'apt-key',
'import',
key
]
subprocess.check_call(cmd)
if key != "":
cmd = [
'apt-key',
'import',
key
]
subprocess.check_call(cmd)
cmd = [
'apt-get',
'update'

View File

@ -1,5 +1,5 @@
[global]
auth supported = cephx
auth supported = {{ auth_supported }}
keyring = /etc/ceph/$cluster.$name.keyring
mon host = {{ mon_hosts }}
fsid = {{ fsid }}