when err is nil,remove err from glog

pull/6/head
lojies 2016-09-09 10:50:49 +08:00
parent 99493570c3
commit e687f58dbc
1 changed files with 20 additions and 4 deletions

View File

@ -113,7 +113,12 @@ func (plugin *execNetworkPlugin) Init(host network.Host, hairpinMode componentco
plugin.host = host
// call the init script
out, err := utilexec.New().Command(plugin.getExecutable(), initCmd).CombinedOutput()
glog.V(5).Infof("Init 'exec' network plugin output: %s, %v", string(out), err)
if err != nil {
glog.V(5).Infof("Init 'exec' network plugin output: %s, %v", string(out), err)
} else {
glog.V(5).Infof("Init 'exec' network plugin output: %s", string(out))
}
return err
}
@ -137,21 +142,32 @@ func (plugin *execNetworkPlugin) validate() error {
func (plugin *execNetworkPlugin) SetUpPod(namespace string, name string, id kubecontainer.ContainerID) error {
out, err := utilexec.New().Command(plugin.getExecutable(), setUpCmd, namespace, name, id.ID).CombinedOutput()
glog.V(5).Infof("SetUpPod 'exec' network plugin output: %s, %v", string(out), err)
if err != nil {
glog.V(5).Infof("SetUpPod 'exec' network plugin output: %s, %v", string(out), err)
} else {
glog.V(5).Infof("SetUpPod 'exec' network plugin output: %s", string(out))
}
return err
}
func (plugin *execNetworkPlugin) TearDownPod(namespace string, name string, id kubecontainer.ContainerID) error {
out, err := utilexec.New().Command(plugin.getExecutable(), tearDownCmd, namespace, name, id.ID).CombinedOutput()
glog.V(5).Infof("TearDownPod 'exec' network plugin output: %s, %v", string(out), err)
if err != nil {
glog.V(5).Infof("TearDownPod 'exec' network plugin output: %s, %v", string(out), err)
} else {
glog.V(5).Infof("TearDownPod 'exec' network plugin output: %s", string(out))
}
return err
}
func (plugin *execNetworkPlugin) GetPodNetworkStatus(namespace string, name string, id kubecontainer.ContainerID) (*network.PodNetworkStatus, error) {
out, err := utilexec.New().Command(plugin.getExecutable(), statusCmd, namespace, name, id.ID).CombinedOutput()
glog.V(5).Infof("Status 'exec' network plugin output: %s, %v", string(out), err)
if err != nil {
glog.V(5).Infof("Status 'exec' network plugin output: %s, %v", string(out), err)
return nil, err
} else {
glog.V(5).Infof("Status 'exec' network plugin output: %s", string(out))
}
if string(out) == "" {
return nil, nil