write out a plausible ceph.conf from config-changed and mon-relation-*

add an "extra" newline to the template so that the generated ceph.conf ends with a newline
This commit is contained in:
Paul Collins 2012-10-03 03:49:19 +13:00
parent 425a44277d
commit 4600527dc8
3 changed files with 17 additions and 3 deletions

View File

@ -23,6 +23,14 @@ def install():
# TODO: Install the upstart scripts.
utils.juju_log('INFO', 'End install hook.')
def emit_cephconf():
cephcontext = {
'mon_hosts': ' '.join(get_mon_hosts())
}
with open('/etc/ceph/ceph.conf', 'w') as cephconf:
cephconf.write(utils.render_template('ceph.conf', cephcontext))
def config_changed():
utils.juju_log('INFO', 'Begin config-changed hook.')
@ -39,6 +47,9 @@ def config_changed():
sys.exit(1)
osd_devices = utils.config_get('osd-devices')
emit_cephconf()
utils.juju_log('INFO', 'End config-changed hook.')
def get_mon_hosts():
@ -53,7 +64,9 @@ def get_mon_hosts():
return hosts
def mon_relation():
print "mon_relation"
utils.juju_log('INFO', 'Begin mon-relation hook.')
emit_cephconf()
utils.juju_log('INFO', 'End mon-relation hook.')
hooks = {
'mon-relation-joined': mon_relation,

View File

@ -1 +1 @@
18
25

View File

@ -1,7 +1,7 @@
[global]
auth supported = none
keyring = /etc/ceph/$cluster.$name.keyring
mon host =
mon host = {{ mon_hosts }}
[mon]
keyring = /var/lib/ceph/mon/$cluster-$id/keyring
@ -13,3 +13,4 @@
keyring = /var/lib/ceph/osd/$cluster-$id/keyring
osd journal size = 1000
filestore xattr use omap = true