Merge pull request #104 from richardxz/master

add some log and delete some useless log
This commit is contained in:
richardxz
2018-06-21 10:22:37 +08:00
committed by GitHub

View File

@@ -79,9 +79,8 @@ func makeHttpRequest(method, url, data string) ([]byte, error) {
} }
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
glog.Error(string(body))
defer resp.Body.Close() defer resp.Body.Close()
return body, nil return body, err
} }
func (ctl *NamespaceCtl) getKubeConfig(user string) (string, error) { func (ctl *NamespaceCtl) getKubeConfig(user string) (string, error) {
@@ -203,23 +202,28 @@ func (ctl *NamespaceCtl) createRoleAndRuntime(item v1.Namespace) {
err = ctl.createDefaultRoleBinding(ns, user) err = ctl.createDefaultRoleBinding(ns, user)
if err != nil { if err != nil {
glog.Error(err)
return return
} }
resp, err := ctl.createOpRuntime(ns, user) resp, err := ctl.createOpRuntime(ns, user)
if err != nil { if err != nil {
glog.Error(resp) glog.Error(err)
return return
} }
var runtime runTime var runtime runTime
err = json.Unmarshal(resp, &runtime) err = json.Unmarshal(resp, &runtime)
if err != nil { if err != nil {
glog.Error(err)
return return
} }
item.Annotations[openpitrix_runtime] = runtime.RuntimeId item.Annotations[openpitrix_runtime] = runtime.RuntimeId
ctl.K8sClient.CoreV1().Namespaces().Update(&item) _, err = ctl.K8sClient.CoreV1().Namespaces().Update(&item)
if err != nil {
glog.Error(err)
}
} }
} }