Add admin key
This commit is contained in:
parent
20279348ce
commit
641255c68d
|
@ -11,7 +11,7 @@ This interface layer will set the following states, as appropriate:
|
|||
|
||||
* `{relation_name}.available` The ceph client has been related to a provider.
|
||||
The following accessors will be available:
|
||||
- key - The admin cephx key
|
||||
- key - The mds cephx key
|
||||
- auth - Whether or not strict auth is supported
|
||||
- mon_hosts - The public addresses list of the monitor cluster
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name: ceph-admin
|
||||
summary: Ceph Admin Client Interface
|
||||
name: ceph-mds
|
||||
summary: Ceph MDS Client Interface
|
||||
version: 1
|
||||
|
|
12
requires.py
12
requires.py
|
@ -8,9 +8,11 @@ class CephClient(RelationBase):
|
|||
scope = scopes.GLOBAL
|
||||
auto_accessors = ['key', 'fsid', 'auth', 'mon_hosts']
|
||||
|
||||
@hook('{requires:ceph-admin}-relation-{joined,changed}')
|
||||
@hook('{requires:ceph-mds}-relation-{joined,changed}')
|
||||
def changed(self):
|
||||
self.set_remote(key='mds-name', value='a')
|
||||
self.set_state('{relation_name}.connected')
|
||||
admin_key = None
|
||||
key = None
|
||||
fsid = None
|
||||
auth = None
|
||||
|
@ -21,6 +23,11 @@ class CephClient(RelationBase):
|
|||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
admin_key = self.admin_key
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
fsid = self.fsid
|
||||
except AttributeError:
|
||||
|
@ -38,6 +45,7 @@ class CephClient(RelationBase):
|
|||
|
||||
data = {
|
||||
'key': key,
|
||||
'admin_key': admin_key,
|
||||
'fsid': fsid,
|
||||
'auth': auth,
|
||||
'mon_hosts': mon_hosts
|
||||
|
@ -46,7 +54,7 @@ class CephClient(RelationBase):
|
|||
if all(data.values()):
|
||||
self.set_state('{relation_name}.available')
|
||||
|
||||
@hook('{requires:ceph-admin}-relation-{broken,departed}')
|
||||
@hook('{requires:ceph-mds}-relation-{broken,departed}')
|
||||
def broken(self):
|
||||
if is_state('{relation_name}.available'):
|
||||
self.remove_state('{relation_name}.available')
|
||||
|
|
Loading…
Reference in New Issue