Skip to content

Commit

Permalink
Move LDAP functionality to ceph-qe-scripts instead of cephci
Browse files Browse the repository at this point in the history
Signed-off-by: Tejas Chandramouli <[email protected]>
  • Loading branch information
TejasC88 committed Jun 17, 2024
1 parent b41f052 commit 323d4c4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions rgw/v2/tests/aws/test_ldap_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,36 @@ def test_exec(config, ssh_con):
io_info_initialize = IOInfoInitialize()
basic_io_structure = BasicIOInfoStructure()
io_info_initialize.initialize(basic_io_structure.initial())

res = utils.exec_shell_cmd("echo '1*redhat' >/etc/bindpass")

rgw_service_name = utils.exec_shell_cmd("ceph orch ls | grep rgw").split(" ")[0]
log.info(f"rgw service name is {rgw_service_name}")
file_name = "/home/rgw_spec.yml"
utils.exec_shell_cmd(
f"ceph orch ls --service-name {rgw_service_name} --export > {file_name}"
)
op = utils.exec_shell_cmd(f"cat {file_name}")
log.info(f"rgw spec is \n {op}")
indent = " "
new_content = f'extra_container_args:\n{indent} - "-v"\n{indent} - "/etc/bindpass:/etc/bindpass"'
with open(file_name, "a") as f:
f.write(new_content)
op = utils.exec_shell_cmd(f"cat /home/rgw_spec.yml")
log.info(f"Final rgw spec content is {op}")
cmd = f"ceph orch apply -i {file_name}"
utils.exec_shell_cmd(cmd)

# add conf options to ceph
utils.exec_shell_cmd(f"ceph config set client.{rgw_service_name} rgw_ldap_binddn cn=RGW")
utils.exec_shell_cmd(f"ceph config set client.{rgw_service_name} rgw_ldap_dnattr uid")
utils.exec_shell_cmd(f"ceph config set client.{rgw_service_name} rgw_ldap_searchdn ou=ceph,dc=ceph-amk-test-r5ozm1-node8")
utils.exec_shell_cmd(f"ceph config set client.{rgw_service_name} rgw_ldap_secret /etc/bindpass")
utils.exec_shell_cmd(f"ceph config set client.{rgw_service_name} rgw_ldap_uri ldap://10.0.209.121:389")
utils.exec_shell_cmd(f"ceph config set client.{rgw_service_name} rgw_s3_auth_use_ldap true")

utils.exec_shell_cmd(f"ceph orch restart {rgw_service_name}")

# base64 encode json to get ldap token
user_data = {
"RGW_TOKEN": {
Expand Down

0 comments on commit 323d4c4

Please sign in to comment.