Skip to content

Commit 418d0cd

Browse files
committed
Comment on the workaround. Robust against fixed SDK ...
Let's comment on the SDK issue here. If it should change to return a UUID in the id attribute, we would now still work, so we are robust against a possible direction that a fix might take. Signed-off-by: Kurt Garloff <[email protected]>
1 parent e19ff3c commit 418d0cd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: Tests/iaas/key-manager/check-for-key-manager.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,16 @@ def check_key_manager_permissions(conn: openstack.connection.Connection) -> None
7777
try:
7878
existing_secrets = _find_secret(conn, secret_name)
7979
for secret in existing_secrets:
80-
conn.key_manager.delete_secret(secret.id[secret.id.rfind('/')+1:])
80+
# Workaround for SDK bugs:
81+
# - The id field in reality is a href (containg the UUID at the end)
82+
# - The delete_secret() function contrary to the documentation does
83+
# not accept openstack.key_managerv1.secret.Secret objects nor the
84+
# hrefs, just plain UUIDs.
85+
uuid_part = secret.id.rfind('/') + 1
86+
if uuid_part != 0:
87+
conn.key_manager.delete_secret(secret.id[uuid_part:])
88+
else:
89+
conn.key_manager.delete_secret(secret.id)
8190

8291
conn.key_manager.create_secret(
8392
name=secret_name,

0 commit comments

Comments
 (0)