forked from openstack-charmers/zaza-openstack-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openstack-charmers#5 from cloud-padawan/ceph-proxy…
…-tests added ceph-proxy tests
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Module to setup ceph-proxy charm.""" | ||
|
||
import logging | ||
import zaza.model as model | ||
|
||
|
||
def setup_ceph_proxy(): | ||
""" | ||
Configure ceph proxy with ceph metadata. | ||
Fetches admin_keyring and FSID from ceph-mon and | ||
uses those to configure ceph-proxy. | ||
""" | ||
raw_admin_keyring = model.run_on_leader( | ||
"ceph-mon", 'cat /etc/ceph/ceph.client.admin.keyring')["Stdout"] | ||
admin_keyring = [ | ||
line for line in raw_admin_keyring.split("\n") if "key" in line | ||
][0].split(' = ')[-1].rstrip() | ||
fsid = model.run_on_leader("ceph-mon", "leader-get fsid")["Stdout"] | ||
cluster_ips = model.get_app_ips("ceph-mon") | ||
|
||
proxy_config = { | ||
'auth-supported': 'cephx', | ||
'admin-key': admin_keyring, | ||
'fsid': fsid, | ||
'monitor-hosts': ' '.join(cluster_ips) | ||
} | ||
|
||
logging.debug('Config: {}'.format(proxy_config)) | ||
|
||
model.set_application_config("ceph-proxy", proxy_config) |