Skip to content

Commit d1ac940

Browse files
committed
OK, use a custom field "owner" in the blob to tag cred.
Signed-off-by: Kurt Garloff <[email protected]>
1 parent f035cb6 commit d1ac940

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Tests/iaas/mandatory-services/mandatory-iaas-services.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,18 @@ def s3_from_ostack(creds, conn, endpoint):
129129
for cred in ec2_creds:
130130
# FIXME: Assume cloud is not evil
131131
ec2_dict = eval(cred.blob, {"null": None})
132+
# print(f"DEBUG: Cred: {ec2_dict}")
132133
creds["AK"] = ec2_dict["access"]
133134
creds["SK"] = ec2_dict["secret"]
134135
# Clean up old EC2 creds and jump over
135-
if creds["SK"][-len(EC2MARKER):] == EC2MARKER:
136+
if ec2_dict.get("owner") == EC2MARKER:
136137
conn.identity.delete_credential(cred)
137138
continue
138139
return None
139140
# Generate keyid and secret
140141
ak = uuid.uuid4().hex
141-
sk = uuid.uuid4().hex + EC2MARKER
142-
blob = f'{{"access": "{ak}", "secret": "{sk}"}}'
142+
sk = uuid.uuid4().hex
143+
blob = f'{{"access": "{ak}", "secret": "{sk}", "owner": "{EC2MARKER}"}}'
143144
try:
144145
crd = conn.identity.create_credential(type="ec2", blob=blob,
145146
user_id=conn.current_user_id,

0 commit comments

Comments
 (0)