From cbf55d6dfde2647c9e38aaf1be60e13c761729bf Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Wed, 15 Jun 2016 13:44:40 -0400 Subject: [PATCH] ceph clients can relate through the proxy --- config.yaml | 10 +++++----- hooks/ceph.py | 2 +- hooks/ceph_hooks.py | 4 ++-- metadata.yaml | 3 +++ requirements.txt | 1 + templates/ceph.client.admin.keyring | 3 ++- templates/mon.keyring | 6 +++--- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/config.yaml b/config.yaml index 2d7957d..97ae7ce 100644 --- a/config.yaml +++ b/config.yaml @@ -18,11 +18,11 @@ options: default: description: | Admin cephx key for existing Ceph cluster - mon-key: - type: string - default: - description: | - Monitor cephx key + # mon-key: + # type: string + # default: + # description: | + # Monitor cephx key source: type: string default: diff --git a/hooks/ceph.py b/hooks/ceph.py index 01a2a56..a3bc52d 100644 --- a/hooks/ceph.py +++ b/hooks/ceph.py @@ -372,7 +372,7 @@ def get_named_key(name, caps=None): "-u", ceph_user(), 'ceph', - '--name', 'mon.', + '--name', 'client.admin', '--keyring', '/var/lib/ceph/mon/ceph-{}/keyring'.format( get_unit_hostname() diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py index aa3431f..4d141cc 100755 --- a/hooks/ceph_hooks.py +++ b/hooks/ceph_hooks.py @@ -115,11 +115,11 @@ def emit_cephconf(): charm_ceph_conf, 100) keyring = 'ceph.client.admin.keyring' keyring_path = '/etc/ceph/' + keyring - render(keyring, keyring_path, {'admin_key': config('admin-key')}, perms=0o600) + render(keyring, keyring_path, {'admin_key': config('admin-key')}, owner=ceph.ceph_user(), perms=0o600) keyring = 'keyring' keyring_path = '/var/lib/ceph/mon/ceph-' + get_unit_hostname()+ '/' + keyring - render('mon.keyring', keyring_path, {'mon_key': config('mon-key')}, perms=0o600) + render('mon.keyring', keyring_path, {'admin_key': config('admin-key')}, owner=ceph.ceph_user(), perms=0o600) notify_radosgws() notify_client() diff --git a/metadata.yaml b/metadata.yaml index 0ff3366..72acc5f 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -9,6 +9,9 @@ tags: - storage - file-servers - misc +extra-bindings: + public: + cluster: provides: client: interface: ceph-client diff --git a/requirements.txt b/requirements.txt index 6a3271b..a72939e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ Jinja2>=2.6 # BSD License (3 clause) six>=1.9.0 dnspython>=1.12.0 psutil>=1.1.1,<2.0.0 +charm-tools>=2.0.0 \ No newline at end of file diff --git a/templates/ceph.client.admin.keyring b/templates/ceph.client.admin.keyring index 8975881..ce0a4da 100644 --- a/templates/ceph.client.admin.keyring +++ b/templates/ceph.client.admin.keyring @@ -1,2 +1,3 @@ [client.admin] - key = {{admin_key}} \ No newline at end of file + key = {{admin_key}} + diff --git a/templates/mon.keyring b/templates/mon.keyring index 2b9d542..567c2ea 100644 --- a/templates/mon.keyring +++ b/templates/mon.keyring @@ -1,3 +1,3 @@ -[mon.] - key = {{mon_key}} - caps mon = "allow *" +[client.admin] + key = {{admin_key}} +