未验证 提交 b1f37c7e 编写于 作者: S shendongdong 提交者: GitHub

remove useless log and add detailed log (#2944)

Signed-off-by: Nallenshen <shendongdong@koderover.com>
上级 78151fd0
...@@ -574,7 +574,6 @@ func GenerateRenderedYaml(option *GeneSvcYamlOption) (string, int, []*WorkloadRe ...@@ -574,7 +574,6 @@ func GenerateRenderedYaml(option *GeneSvcYamlOption) (string, int, []*WorkloadRe
return "", 0, nil, err return "", 0, nil, err
} }
fullRenderedYaml = ParseSysKeys(productInfo.Namespace, productInfo.EnvName, option.ProductName, option.ServiceName, fullRenderedYaml) fullRenderedYaml = ParseSysKeys(productInfo.Namespace, productInfo.EnvName, option.ProductName, option.ServiceName, fullRenderedYaml)
log.Infof("fullRenderedYaml is: %s", fullRenderedYaml)
// service may not be deployed in environment, we need to extract containers again, since image related variables may be changed // service may not be deployed in environment, we need to extract containers again, since image related variables may be changed
latestSvcTemplate.KubeYamls = util.SplitYaml(fullRenderedYaml) latestSvcTemplate.KubeYamls = util.SplitYaml(fullRenderedYaml)
......
...@@ -69,7 +69,7 @@ const ( ...@@ -69,7 +69,7 @@ const (
func NewNacosClient(serverAddr, userName, password string) (*Client, error) { func NewNacosClient(serverAddr, userName, password string) (*Client, error) {
host, err := url.Parse(serverAddr) host, err := url.Parse(serverAddr)
if err != nil { if err != nil {
return nil, errors.New("parse nacos server address failed") return nil, errors.Wrap(err, "parse nacos server address failed")
} }
// add default context path // add default context path
if host.Path == "" { if host.Path == "" {
...@@ -82,7 +82,7 @@ func NewNacosClient(serverAddr, userName, password string) (*Client, error) { ...@@ -82,7 +82,7 @@ func NewNacosClient(serverAddr, userName, password string) (*Client, error) {
SetResult(&result). SetResult(&result).
Post(loginURL) Post(loginURL)
if err != nil { if err != nil {
return nil, errors.New("login nacos failed") return nil, errors.Wrap(err, "login nacos failed")
} }
if !resp.IsSuccess() { if !resp.IsSuccess() {
return nil, errors.New("login nacos failed") return nil, errors.New("login nacos failed")
...@@ -120,7 +120,7 @@ func (c *Client) ListNamespaces() ([]*types.NacosNamespace, error) { ...@@ -120,7 +120,7 @@ func (c *Client) ListNamespaces() ([]*types.NacosNamespace, error) {
url := "/v1/console/namespaces" url := "/v1/console/namespaces"
res := &namespaceResp{} res := &namespaceResp{}
if _, err := c.Client.Get(url, httpclient.SetResult(res)); err != nil { if _, err := c.Client.Get(url, httpclient.SetResult(res)); err != nil {
return nil, errors.New("list nacos namespace failed") return nil, errors.Wrap(err, "list nacos namespace failed")
} }
resp := []*types.NacosNamespace{} resp := []*types.NacosNamespace{}
for _, namespace := range res.Data { for _, namespace := range res.Data {
...@@ -152,7 +152,7 @@ func (c *Client) ListConfigs(namespaceID string) ([]*types.NacosConfig, error) { ...@@ -152,7 +152,7 @@ func (c *Client) ListConfigs(namespaceID string) ([]*types.NacosConfig, error) {
"tenant": namespaceID, "tenant": namespaceID,
}) })
if _, err := c.Client.Get(url, params, httpclient.SetResult(res)); err != nil { if _, err := c.Client.Get(url, params, httpclient.SetResult(res)); err != nil {
return nil, errors.New("list nacos config failed") return nil, errors.Wrap(err, "list nacos config failed")
} }
for _, conf := range res.PageItems { for _, conf := range res.PageItems {
resp = append(resp, &types.NacosConfig{ resp = append(resp, &types.NacosConfig{
...@@ -181,7 +181,7 @@ func (c *Client) GetConfig(dataID, group, namespaceID string) (*types.NacosConfi ...@@ -181,7 +181,7 @@ func (c *Client) GetConfig(dataID, group, namespaceID string) (*types.NacosConfi
"show": "all", "show": "all",
}) })
if _, err := c.Client.Get(url, params, httpclient.SetResult(res)); err != nil { if _, err := c.Client.Get(url, params, httpclient.SetResult(res)); err != nil {
return nil, errors.New("get nacos config failed") return nil, errors.Wrap(err, "get nacos config failed")
} }
return &types.NacosConfig{ return &types.NacosConfig{
DataID: res.DataID, DataID: res.DataID,
...@@ -202,7 +202,7 @@ func (c *Client) UpdateConfig(dataID, group, namespaceID, content, format string ...@@ -202,7 +202,7 @@ func (c *Client) UpdateConfig(dataID, group, namespaceID, content, format string
"type": setFormat(format), "type": setFormat(format),
} }
if _, err := c.Client.Post(path, httpclient.SetFormData(formValues)); err != nil { if _, err := c.Client.Post(path, httpclient.SetFormData(formValues)); err != nil {
return errors.New("update nacos config failed") return errors.Wrap(err, "update nacos config failed")
} }
return nil return nil
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册