Skip to content

Commit bd882af

Browse files
committed
fix(seaweedfs): return updated BucketVO from createBucket instead of stale input
createBucket persisted the new access key, secret key, and bucket URL on a separately loaded BucketVO but returned the original input Bucket object. BucketApiServiceImpl.createBucket then set only the state on that original object and updated it again, overwriting the persisted credentials with the stale values from the input. Return the updated BucketVO (as the Cloudian driver does) so the caller persists the correct credentials.
1 parent 88c8574 commit bd882af

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

plugins/storage/object/seaweedfs/src/main/java/org/apache/cloudstack/storage/datastore/driver/SeaweedFSObjectStoreDriverImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@ public Bucket createBucket(Bucket bucket, boolean objectLock) {
415415
AmazonIdentityManagement iamClient = getIAMClient(storeId);
416416
updateAccountIAMPolicy(iamClient, storeId, accountId, null);
417417

418-
return bucket;
418+
// Return the updated BucketVO (not the stale input bucket) so
419+
// BucketApiServiceImpl.createBucket does not overwrite the
420+
// persisted credentials with the stale values.
421+
return bucketVO;
419422
} catch (Exception e) {
420423
logger.error("Post-create bucket record update failed for {}; cleaning up remote bucket", bucketName, e);
421424
try {

0 commit comments

Comments
 (0)