Skip to content

Commit

Permalink
Return a Error message if there's no vpc name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeon-Jinhyeok committed Feb 6, 2025
1 parent f55c8b4 commit ed13439
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions api-runtime/common-runtime/SecurityGroupManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions setup.env
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ed13439

Please sign in to comment.