@@ -454,7 +454,7 @@ def create_subaccount(self):
454
454
455
455
subaccount = createSubaccountName (self )
456
456
subdomain = createSubdomainID (self )
457
-
457
+
458
458
log .success ("using subaccount name >" + subaccount + "<" )
459
459
log .success ("using subaccount domain >" + subdomain + "<" )
460
460
@@ -468,9 +468,9 @@ def create_subaccount(self):
468
468
"Create sub account >" + subaccount + "< (if not already existing)"
469
469
)
470
470
471
- subaccountid = checkIfSubaccountAlreadyExists (self )
472
-
473
- if subaccountid is None :
471
+ subaccountExist = checkIfSubaccountAlreadyExists (self )
472
+
473
+ if subaccountExist is None :
474
474
command = (
475
475
"btp --format json create accounts/subaccount \
476
476
--display-name '"
@@ -532,19 +532,29 @@ def create_subaccount(self):
532
532
+ "<"
533
533
)
534
534
else :
535
+ subaccountid = subaccountExist [0 ]
536
+ subdomain = subaccountExist [1 ]
535
537
log .success (
536
538
"subaccount >"
537
539
+ subaccount
538
540
+ "< already exists with id >"
539
541
+ subaccountid
542
+ + "< and subdomain >"
543
+ + subdomain
540
544
+ "<"
541
545
)
542
546
self .subaccountid = subaccountid
547
+ self .subdomain = subdomain
543
548
544
549
self .accountMetadata = addKeyValuePair (
545
- accountMetadata , "subaccountid" , subaccountid
550
+ accountMetadata , "subaccountid" , subaccountid
546
551
)
552
+ self .accountMetadata = addKeyValuePair (
553
+ accountMetadata , "subdomain" , subdomain
554
+ )
555
+
547
556
self .subaccountid = subaccountid
557
+ self .subdomain = subdomain
548
558
else :
549
559
log .header (
550
560
"USING CONFIGURED SUBACCOUNT WITH ID >" + self .subaccountid + "<"
@@ -1387,13 +1397,13 @@ def checkIfSubaccountAlreadyExists(btpUsecase: BTPUSECASE):
1387
1397
+ "'"
1388
1398
)
1389
1399
result = runCommandAndGetJsonResult (btpUsecase , command , "INFO" , None )
1390
-
1400
+
1391
1401
if "subaccount" in accountMetadata :
1392
1402
subaccountName = accountMetadata ["subaccount" ]
1393
1403
1394
1404
for account in result ["value" ]:
1395
1405
if account ["displayName" ] == subaccountName :
1396
- return account ["guid" ]
1406
+ return account ["guid" ], account [ "subdomain" ]
1397
1407
# If the for loop didn't return any value, the subaccount wasn't found
1398
1408
return None
1399
1409
else :
0 commit comments