diff --git a/hooks/hooks.py b/hooks/hooks.py index 3fe6fa0..c47f79a 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -7,25 +7,32 @@ # Paul Collins # +import glob import os import subprocess +import shutil import socket import sys import ceph import utils +def install_upstart_scripts(): + for x in glob.glob('files/upstart/*.conf'): + shutil.copy(x, '/etc/init/') + def install(): utils.juju_log('INFO', 'Begin install hook.') utils.configure_source() utils.install('ceph') - # TODO: Install the upstart scripts. + install_upstart_scripts() + utils.juju_log('INFO', 'End install hook.') def emit_cephconf(): cephcontext = { - 'mon_hosts': ' '.join(get_mon_hosts().sort()), + 'mon_hosts': ' '.join(get_mon_hosts()), 'fsid': utils.config_get('fsid'), } @@ -65,6 +72,7 @@ def get_mon_hosts(): unit, relid)) + ':6789') + hosts.sort() return hosts def mon_relation(): @@ -75,6 +83,7 @@ def mon_relation(): def upgrade_charm(): utils.juju_log('INFO', 'Begin upgrade-charm hook.') emit_cephconf() + install_upstart_scripts() utils.juju_log('INFO', 'End upgrade-charm hook.') hooks = { diff --git a/hooks/utils.py b/hooks/utils.py index 9b08a90..1d6af72 100644 --- a/hooks/utils.py +++ b/hooks/utils.py @@ -104,7 +104,7 @@ def relation_get(attribute,unit=None,rid=None): cmd.append(unit) return subprocess.check_output(cmd).strip() -def relation_set(*kwargs): +def relation_set(**kwargs): cmd = [ "relation-set" ] diff --git a/revision b/revision index a787364..81b5c5d 100644 --- a/revision +++ b/revision @@ -1 +1 @@ -34 +37