From: Sage Weil Date: Sat, 16 Feb 2013 01:19:32 +0000 (-0800) Subject: ceph: put client keyrings in /etc/ceph/ceph.$name.keyring X-Git-Tag: 1.1.0~2312^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eadefec8ff46e0c577bd64150abaad513d442fbc;p=teuthology.git ceph: put client keyrings in /etc/ceph/ceph.$name.keyring And make it world readable, for ubuntu's sake. Signed-off-by: Sage Weil --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 148ce7d42..9d5918e97 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -543,6 +543,9 @@ def reconnect(ctx, timeout): def write_secret_file(ctx, remote, role, filename): testdir = get_testdir(ctx) + keyring = '{tdir}/data/{role}.keyring'.format(tdir=testdir, role=role) + if role.startswith('client.'): + keyring = '/etc/ceph/ceph.{role}.keyring'.format(role=role) remote.run( args=[ '{tdir}/enable-coredump'.format(tdir=testdir), @@ -551,7 +554,7 @@ def write_secret_file(ctx, remote, role, filename): 'ceph-authtool', '--name={role}'.format(role=role), '--print-key', - '{tdir}/data/{role}.keyring'.format(tdir=testdir, role=role), + keyring, run.Raw('>'), filename, ], diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index b2aa944d2..b2840eceb 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -622,17 +622,24 @@ def cluster(ctx, config): clients = ctx.cluster.only(teuthology.is_type('client')) for remote, roles_for_host in clients.remotes.iteritems(): for id_ in teuthology.roles_of_type(roles_for_host, 'client'): + client_keyring = '/etc/ceph/ceph.client.{id}.keyring'.format(id=id_) remote.run( args=[ '{tdir}/enable-coredump'.format(tdir=testdir), 'ceph-coverage', coverage_dir, + 'sudo', 'ceph-authtool', '--create-keyring', '--gen-key', # TODO this --name= is not really obeyed, all unknown "types" are munged to "client" '--name=client.{id}'.format(id=id_), - '{tdir}/data/client.{id}.keyring'.format(tdir=testdir, id=id_), + client_keyring, + run.Raw('&&'), + 'sudo', + 'chmod', + '0644', + client_keyring, ], ) @@ -640,7 +647,7 @@ def cluster(ctx, config): keys_fp = StringIO() keys = [] for remote, roles_for_host in ctx.cluster.remotes.iteritems(): - for type_ in ['osd', 'mds', 'client']: + for type_ in ['osd', 'mds']: for id_ in teuthology.roles_of_type(roles_for_host, type_): data = teuthology.get_file( remote=remote, @@ -652,6 +659,15 @@ def cluster(ctx, config): ) keys.append((type_, id_, data)) keys_fp.write(data) + for remote, roles_for_host in ctx.cluster.remotes.iteritems(): + for type_ in ['client']: + for id_ in teuthology.roles_of_type(roles_for_host, type_): + data = teuthology.get_file( + remote=remote, + path='/etc/ceph/ceph.client.{id}.keyring'.format(id=id_) + ) + keys.append((type_, id_, data)) + keys_fp.write(data) log.info('Adding keys to all mons...') writes = mons.run(