From 632bb6015c159c8796562b088d415116c6ad7f1f Mon Sep 17 00:00:00 2001 From: James Page Date: Tue, 9 Oct 2012 13:35:06 +0100 Subject: [PATCH] Added cephx support --- README | 8 ++++++-- TODO | 1 - hooks/hooks.py | 15 +++++++++++---- revision | 2 +- templates/ceph.conf | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README b/README index 9bc2552d..af3872be 100644 --- a/README +++ b/README @@ -30,9 +30,13 @@ The gateway can be accessed over port 80 (as show in juju status exposed ports). Note that you will need to login to one of the service units supporting the -ceph-radosgw charm to generate some access credentials:: +ceph charm to generate some access credentials:: - radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph" + juju ssh ceph/0 \ + 'sudo radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph"' + +For security reasons the ceph-radosgw charm is not setup with appropriate +permissions to administer the ceph cluster. Scale-out ========= diff --git a/TODO b/TODO index cd30ef3b..75ceb8d5 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ RADOS Gateway Charm ------------------- - * cephx support * Improved process control of radosgw daemon (to many restarts) diff --git a/hooks/hooks.py b/hooks/hooks.py index 23f3babb..ddff6e22 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -12,6 +12,7 @@ import subprocess import sys import glob import os +import ceph import utils @@ -99,7 +100,10 @@ def get_mon_hosts(): def mon_relation(): utils.juju_log('INFO', 'Begin mon-relation hook.') emit_cephconf() - restart() + key = utils.relation_get('radosgw_key') + if key != "": + ceph.import_radosgw_key(key) + restart() # TODO figure out a better way todo this utils.juju_log('INFO', 'End mon-relation hook.') @@ -116,14 +120,18 @@ def upgrade_charm(): def start(): - # In case we're being redeployed to the same machines, try - # to make sure everything is running as soon as possible. + subprocess.call(['service', 'radosgw', 'start']) + utils.expose(port=80) + + +def stop(): subprocess.call(['service', 'radosgw', 'start']) utils.expose(port=80) def restart(): subprocess.call(['service', 'radosgw', 'restart']) + utils.expose(port=80) utils.do_hooks({ @@ -132,7 +140,6 @@ utils.do_hooks({ 'mon-relation-departed': mon_relation, 'mon-relation-changed': mon_relation, 'gateway-relation-joined': gateway_relation, - 'start': start, 'upgrade-charm': config_changed, # same function ATM }) diff --git a/revision b/revision index b4de3947..8351c193 100644 --- a/revision +++ b/revision @@ -1 +1 @@ -11 +14 diff --git a/templates/ceph.conf b/templates/ceph.conf index 73389c63..9dcbbd7c 100644 --- a/templates/ceph.conf +++ b/templates/ceph.conf @@ -1,5 +1,5 @@ [global] - auth supported = none + auth supported = cephx mon host = {{ mon_hosts }} [client.radosgw.gateway]