Skip to content

Commit

Permalink
[Alibaba, AWS, Tencent, GCP] fmt.print change cblogger or removed
Browse files Browse the repository at this point in the history
  • Loading branch information
CliffSynn committed Jun 3, 2024
1 parent c1d1170 commit d419baa
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (clusterHandler *TencentClusterHandler) SetNodeGroupAutoScaling(clusterIID
calllogger.Error(call.String(callLogInfo))
return false, err
}
cblogger.Info(temp.ToJsonString())
cblogger.Debug(temp.ToJsonString())
calllogger.Info(call.String(callLogInfo))

return true, nil
Expand Down Expand Up @@ -326,7 +326,7 @@ func (clusterHandler *TencentClusterHandler) ChangeNodeGroupScaling(clusterIID i
calllogger.Error(call.String(callLogInfo))
return irs.NodeGroupInfo{}, err
}
cblogger.Info(temp.ToJsonString())
cblogger.Debug(temp.ToJsonString())
calllogger.Info(call.String(callLogInfo))

node_group_info, err := getNodeGroupInfo(clusterHandler.CredentialInfo.ClientId, clusterHandler.CredentialInfo.ClientSecret, clusterHandler.RegionInfo.Region, clusterIID.SystemId, nodeGroupIID.SystemId)
Expand All @@ -353,7 +353,7 @@ func (clusterHandler *TencentClusterHandler) RemoveNodeGroup(clusterIID irs.IID,
calllogger.Error(call.String(callLogInfo))
return false, err
}
cblogger.Info(res.ToJsonString())
cblogger.Debug(res.ToJsonString())
calllogger.Info(call.String(callLogInfo))

return true, nil
Expand All @@ -373,7 +373,7 @@ func (clusterHandler *TencentClusterHandler) UpgradeCluster(clusterIID irs.IID,
calllogger.Error(call.String(callLogInfo))
return irs.ClusterInfo{}, err
}
cblogger.Info(res.ToJsonString())
cblogger.Debug(res.ToJsonString())
calllogger.Info(call.String(callLogInfo))

clusterInfo, err := getClusterInfo(clusterHandler.CredentialInfo.ClientId, clusterHandler.CredentialInfo.ClientSecret, clusterHandler.RegionInfo.Region, clusterIID.SystemId)
Expand Down Expand Up @@ -539,7 +539,7 @@ func getClusterAccessInfo(access_key string, access_secret string, region_id str
res, err := tencent.GetClusterEndpoint(access_key, access_secret, region_id, cluster_id)
if err != nil {
if strings.Contains(err.Error(), "CLUSTER_IN_ABNORMAL_STAT") || strings.Contains(err.Error(), "CLUSTER_STATE_ERROR") {
cblogger.Info(cluster_id + err.Error())
cblogger.Error(cluster_id + err.Error())
accessInfo.Endpoint = "Cluster is not ready yet!"
} else {
err := fmt.Errorf("Failed to Get Cluster Endpoint: %v", err)
Expand All @@ -556,10 +556,10 @@ func getClusterAccessInfo(access_key string, access_secret string, region_id str
_, err := tencent.CreateClusterEndpoint(access_key, access_secret, region_id, cluster_id, security_group_id)
if err != nil {
if strings.Contains(err.Error(), "CLUSTER_IN_ABNORMAL_STAT") || strings.Contains(err.Error(), "CLUSTER_STATE_ERROR") {
cblogger.Info(cluster_id + err.Error())
cblogger.Error(cluster_id + err.Error())
accessInfo.Endpoint = "First, add a nodegroup."
} else if strings.Contains(err.Error(), "same type task in execution") {
cblogger.Info(cluster_id + err.Error())
cblogger.Error(cluster_id + err.Error())
accessInfo.Endpoint = "Preparing...."
} else {
err := fmt.Errorf("Failed to Create Cluster Endpoint: %v", err)
Expand All @@ -575,7 +575,7 @@ func getClusterAccessInfo(access_key string, access_secret string, region_id str
resKubeconfig, err := tencent.GetClusterKubeconfig(access_key, access_secret, region_id, cluster_id)
if err != nil {
if strings.Contains(err.Error(), "CLUSTER_IN_ABNORMAL_STAT") || strings.Contains(err.Error(), "CLUSTER_STATE_ERROR") {
cblogger.Info(cluster_id + err.Error())
cblogger.Error(cluster_id + err.Error())
accessInfo.Kubeconfig = "Cluster is not ready yet!"
} else {
err := fmt.Errorf("Failed to Get Cluster Kubeconfig: %v", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ func ConvertKeyValueList(v interface{}) ([]irs.KeyValue, error) {
// array에 주어진 string이 있는지 체크
func ContainString(s []string, str string) bool {
for _, v := range s {
cblogger.Info(v + " : " + str)
cblogger.Info(v == str)
cblogger.Debug(v + " : " + str)
cblogger.Debug(v == str)
if v == str {
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type TencentImageHandler struct {

// @TODO - 이미지 생성에 따른 구조체 정의 필요 - 현재는 IID뿐이 없어서 이미지 이름으로만 생성하도록 했음.(인스턴스Id가 없어서 에러 발생함.)
func (imageHandler *TencentImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error) {
cblogger.Info(imageReqInfo)
cblogger.Debug(imageReqInfo)

callogger := call.GetLogger("HISCALL")
callLogInfo := call.CLOUDLOGSCHEMA{
Expand Down Expand Up @@ -65,7 +65,7 @@ func (imageHandler *TencentImageHandler) CreateImage(imageReqInfo irs.ImageReqIn
cblogger.Error(err)
return irs.ImageInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -112,7 +112,7 @@ func (imageHandler *TencentImageHandler) ListImage() ([]*irs.ImageInfo, error) {
cblogger.Error(err)
return nil, err
}
//spew.Dump(response)
//cblogger.Debug(response)
//cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand All @@ -123,12 +123,12 @@ func (imageHandler *TencentImageHandler) ListImage() ([]*irs.ImageInfo, error) {
imageInfoList = append(imageInfoList, &imageInfo)
}

//spew.Dump(imageInfoList)
//cblogger.Debug(imageInfoList)
return imageInfoList, nil
}

func ExtractImageDescribeInfo(image *cvm.Image) irs.ImageInfo {
//spew.Dump(image)
//cblogger.Debug(image)
imageInfo := irs.ImageInfo{
//IId: irs.IID{*image.Name, *image.ImageId},
IId: irs.IID{NameId: *image.ImageId, SystemId: *image.ImageId},
Expand Down Expand Up @@ -181,7 +181,7 @@ func (imageHandler *TencentImageHandler) GetImage(imageIID irs.IID) (irs.ImageIn
return irs.ImageInfo{}, err
}

//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -222,7 +222,7 @@ func (imageHandler *TencentImageHandler) DeleteImage(imageIID irs.IID) (bool, er
cblogger.Error(err)
return false, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
call "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/call-log"
idrv "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces"
irs "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources"
"github.com/davecgh/go-spew/spew"
_ "github.com/davecgh/go-spew/spew"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
Expand Down Expand Up @@ -46,7 +45,7 @@ func (keyPairHandler *TencentKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, erro
cblogger.Error(err)
return nil, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand All @@ -55,7 +54,7 @@ func (keyPairHandler *TencentKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, erro
if errKeyPair != nil {
// 2021-10-27 이슈#480에 의해 Local Key 로직 제거
//cblogger.Infof("[%s] KeyPair는 Local에서 관리하는 대상이 아니기 때문에 Skip합니다.", *pair.KeyName)
cblogger.Info(errKeyPair.Error())
cblogger.Error(errKeyPair.Error())
//return nil, errKeyPair
} else {
keyPairList = append(keyPairList, &keyPairInfo)
Expand All @@ -66,9 +65,9 @@ func (keyPairHandler *TencentKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, erro
}

// 2021-10-27 이슈#480에 의해 Local Key 로직 제거
//KeyPair 정보를 추출함
// KeyPair 정보를 추출함
func ExtractKeyPairDescribeInfo(keyPair *cvm.KeyPair) (irs.KeyPairInfo, error) {
spew.Dump(keyPair)
cblogger.Debug(keyPair)
keyPairInfo := irs.KeyPairInfo{
IId: irs.IID{NameId: *keyPair.KeyName, SystemId: *keyPair.KeyId},
//PublicKey: *keyPair.PublicKey,
Expand Down Expand Up @@ -120,7 +119,7 @@ func ExtractKeyPairDescribeInfo(keyPair *cvm.KeyPair) (irs.KeyPairInfo, error) {
}

// 2021-10-27 이슈#480에 의해 Local Key 로직 제거
//KeyPair 생성시 이름은 알파벳, 숫자 또는 밑줄 "_"만 지원
// KeyPair 생성시 이름은 알파벳, 숫자 또는 밑줄 "_"만 지원
func (keyPairHandler *TencentKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error) {
cblogger.Info(keyPairReqInfo)

Expand Down Expand Up @@ -175,12 +174,12 @@ func (keyPairHandler *TencentKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPai
cblogger.Error(err)
return irs.KeyPairInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

cblogger.Infof("Created [%s]key pair", *response.Response.KeyPair.KeyName)
//spew.Dump(result)
//cblogger.Debug(result)
keyPairInfo := irs.KeyPairInfo{
//Name: *result.KeyName,
IId: irs.IID{NameId: keyPairReqInfo.IId.NameId, SystemId: *response.Response.KeyPair.KeyId},
Expand All @@ -191,7 +190,7 @@ func (keyPairHandler *TencentKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPai
},
}

//spew.Dump(keyPairInfo)
//cblogger.Debug(keyPairInfo)

/* 2021-10-27 이슈#480에 의해 Local Key 로직 제거
//=============================
Expand Down Expand Up @@ -288,7 +287,7 @@ func (keyPairHandler *TencentKeyPairHandler) GetKey(keyIID irs.IID) (irs.KeyPair
cblogger.Error(err)
return irs.KeyPairInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand All @@ -299,7 +298,7 @@ func (keyPairHandler *TencentKeyPairHandler) GetKey(keyIID irs.IID) (irs.KeyPair
return irs.KeyPairInfo{}, errKeyPair
}

//spew.Dump(keyPairInfo)
//cblogger.Debug(keyPairInfo)
return keyPairInfo, nil
} else {
return irs.KeyPairInfo{}, errors.New("정보를 찾을 수 없습니다.")
Expand Down Expand Up @@ -363,7 +362,7 @@ func (keyPairHandler *TencentKeyPairHandler) DeleteKey(keyIID irs.IID) (bool, er
cblogger.Error(err)
return false, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
call "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/call-log"
idrv "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces"
irs "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources"
"github.com/davecgh/go-spew/spew"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"

//cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
Expand Down Expand Up @@ -113,7 +112,7 @@ func (myImageHandler *TencentMyImageHandler) SnapshotVM(snapshotReqInfo irs.MyIm
}
calllogger.Info(call.String(hiscallInfo))

spew.Dump(response)
cblogger.Debug(response)

myImageInfo, myImageErr := myImageHandler.GetMyImage(irs.IID{SystemId: *response.Response.ImageId})
if myImageErr != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

idrv "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces"
irs "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources"
"github.com/davecgh/go-spew/spew"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
)
Expand Down Expand Up @@ -406,7 +405,7 @@ func mappingProductInfo(regionName string, i interface{}) irs.ProductInfo {
// storage 관련 정보 삭제
return productInfo
default:
spew.Dump(v)
cblogger.Debug(v)
}

return irs.ProductInfo{}
Expand Down Expand Up @@ -476,7 +475,7 @@ func mappingPricingPolicy(instanceChargeType *string, price any) irs.PricingPoli
policyInfo.OfferingClass = strPtrNilCheck(nil)

default:
//spew.Dump(objType)
//cblogger.Debug(objType)
cblogger.Info("Type doesn't match", reflect.TypeOf(price))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
call "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/call-log"
idrv "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces"
irs "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources"
"github.com/davecgh/go-spew/spew"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
)
Expand Down Expand Up @@ -99,11 +98,11 @@ func (securityHandler *TencentSecurityHandler) CreateSecurity(securityReqInfo ir
callogger.Error(call.String(callLogInfo))

cblogger.Error(err)
spew.Dump(defaultEgressRequest)
cblogger.Debug(defaultEgressRequest)
return irs.SecurityInfo{}, err
}

//spew.Dump(defaultEgressResponse)
//cblogger.Debug(defaultEgressResponse)
cblogger.Debug(defaultEgressResponse.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -148,10 +147,10 @@ func (securityHandler *TencentSecurityHandler) CreateSecurity(securityReqInfo ir
callogger.Error(call.String(callLogInfo))

cblogger.Error(err)
spew.Dump(request)
cblogger.Debug(request)
return irs.SecurityInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -192,7 +191,7 @@ func (securityHandler *TencentSecurityHandler) ListSecurity() ([]*irs.SecurityIn
cblogger.Error(err)
return nil, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -263,7 +262,7 @@ func (securityHandler *TencentSecurityHandler) GetSecurity(securityIID irs.IID)
cblogger.Error(err)
return irs.SecurityInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -295,7 +294,7 @@ func (securityHandler *TencentSecurityHandler) GetSecurityRuleInfo(securityIID i
cblogger.Error(err)
return nil, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())

var securityRuleInfos []irs.SecurityRuleInfo
Expand Down Expand Up @@ -400,7 +399,7 @@ func (securityHandler *TencentSecurityHandler) DeleteSecurity(securityIID irs.II
cblogger.Error(err)
return false, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(response.ToJsonString())
callogger.Info(call.String(callLogInfo))

Expand Down Expand Up @@ -497,7 +496,7 @@ func (securityHandler *TencentSecurityHandler) AddRules(securityIID irs.IID, req
cblogger.Error(err)
return irs.SecurityInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(ingressResponse.ToJsonString())
callogger.Info(call.String(callLogInfo))
}
Expand All @@ -519,7 +518,7 @@ func (securityHandler *TencentSecurityHandler) AddRules(securityIID irs.IID, req
cblogger.Error(err)
return irs.SecurityInfo{}, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(egressResponse.ToJsonString())
callogger.Info(call.String(callLogInfo))
}
Expand Down Expand Up @@ -608,7 +607,7 @@ func (securityHandler *TencentSecurityHandler) RemoveRules(securityIID irs.IID,
cblogger.Error(err)
return false, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(ingressResponse.ToJsonString())
callogger.Info(call.String(callLogInfo))
}
Expand All @@ -629,7 +628,7 @@ func (securityHandler *TencentSecurityHandler) RemoveRules(securityIID irs.IID,
cblogger.Error(err)
return false, err
}
//spew.Dump(response)
//cblogger.Debug(response)
cblogger.Debug(egressResponse.ToJsonString())
callogger.Info(call.String(callLogInfo))
}
Expand Down Expand Up @@ -686,7 +685,7 @@ func sameRulesCheck(presentSecurityRules *[]irs.SecurityRuleInfo, reqSecurityRul
}

if action == Add {
cblogger.Info("add")
cblogger.Debug("add")
checkResult = append(checkResult, reqRule)
}
hasFound = true
Expand Down
Loading

0 comments on commit d419baa

Please sign in to comment.