From ed13439a1f89359b9d17edfd14095c57b262132d Mon Sep 17 00:00:00 2001 From: jinhyeok Date: Thu, 6 Feb 2025 11:53:53 +0900 Subject: [PATCH] Return a Error message if there's no vpc name --- api-runtime/common-runtime/SecurityGroupManager.go | 14 ++++++++++++-- setup.env | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/api-runtime/common-runtime/SecurityGroupManager.go b/api-runtime/common-runtime/SecurityGroupManager.go index d3037b9b3..862652aab 100644 --- a/api-runtime/common-runtime/SecurityGroupManager.go +++ b/api-runtime/common-runtime/SecurityGroupManager.go @@ -629,7 +629,17 @@ func ListVpcSecurity(connectionName, rsType, vpcName string) ([]*cres.SecurityIn return nil, err } - //(1) get IId of SG for typical vpc -> iidInfoList + // (0) check whether vpcName is exist + var vpcIIDInfo VPCIIDInfo + isExist, _ := infostore.HasByConditions(&vpcIIDInfo, CONNECTION_NAME_COLUMN, connectionName, + NAME_ID_COLUMN, vpcName) + if !isExist { + err := fmt.Errorf("%s", "The VPC-"+vpcName+" does not exist!") + cblog.Error(err) + return nil, err + } + + // (1) get IId of SG for typical vpc -> iidInfoList var iidInfoList []*SGIIDInfo if os.Getenv("PERMISSION_BASED_CONTROL_MODE") != "" { var iidInfoListAll []*SGIIDInfo @@ -651,7 +661,7 @@ func ListVpcSecurity(connectionName, rsType, vpcName string) ([]*cres.SecurityIn } } - //(2) Get Security Group list with iidInfoList + // (2) Get Security Group list with iidInfoList infoList := []*cres.SecurityInfo{} for _, iidInfo := range iidInfoList { sgSPLock.RLock(connectionName, iidInfo.NameId) diff --git a/setup.env b/setup.env index b7a9187dd..267321f60 100644 --- a/setup.env +++ b/setup.env @@ -11,8 +11,8 @@ export CBSPIDER_ROOT=`cd $SCRIPT_DIR && pwd` #export SERVER_ADDRESS=":3000" # examples for K8S env -#export SERVER_ADDRESS=":1024" -#export SERVICE_ADDRESS="1.2.3.4:31024" +export SERVER_ADDRESS="172.23.49.241:1024" +export SERVICE_ADDRESS="172.23.49.241:1024" ### Set the library type of Cloud Driver pkg. # ON is a shared library type.