Skip to content

Commit c41ef21

Browse files
committed
make slightly more Pythonic
Signed-off-by: Matthias Büchse <[email protected]>
1 parent b0fa3f3 commit c41ef21

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Diff for: Tests/iaas/mandatory-services/mandatory-iaas-services.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def s3_from_ostack(creds, conn, endpoint):
143143
if found_ec2:
144144
creds["AK"] = found_ec2["access"]
145145
creds["SK"] = found_ec2["secret"]
146-
return None
146+
return
147147
# Generate keyid and secret
148148
ak = uuid.uuid4().hex
149149
sk = uuid.uuid4().hex
@@ -152,13 +152,12 @@ def s3_from_ostack(creds, conn, endpoint):
152152
crd = conn.identity.create_credential(type="ec2", blob=blob,
153153
user_id=conn.current_user_id,
154154
project_id=conn.current_project_id)
155-
creds["AK"] = ak
156-
creds["SK"] = sk
157-
return crd.id
158-
except BaseException as excn:
159-
logger.warning(f"ec2 creds creation failed: {excn!s}")
160-
# pass
161-
return None
155+
except BaseException:
156+
logger.warning(f"ec2 creds creation failed", exc_info=True)
157+
return
158+
creds["AK"] = ak
159+
creds["SK"] = sk
160+
return crd.id
162161

163162

164163
def check_for_s3_and_swift(conn: openstack.connection.Connection, s3_credentials=None):

0 commit comments

Comments
 (0)