Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log stdout and stderr of tar command #2190

Merged
merged 1 commit into from
Sep 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pkg/occlient/occlient.go
Original file line number Diff line number Diff line change
Expand Up @@ -1187,10 +1187,15 @@ func (c *Client) BootstrapSupervisoredS2I(params CreateArgs, commonObjectMeta me
}
}

_, err = c.appsClient.DeploymentConfigs(c.Namespace).Create(&dc)
createdDC, err := c.appsClient.DeploymentConfigs(c.Namespace).Create(&dc)
if err != nil {
return errors.Wrapf(err, "unable to create DeploymentConfig for %s", commonObjectMeta.Name)
}

var jsonDC []byte
jsonDC, _ = json.Marshal(createdDC)
glog.V(5).Infof("Created new DeploymentConfig:\n%s\n", string(jsonDC))

svc, err := c.CreateService(commonObjectMeta, dc.Spec.Template.Spec.Containers[0].Ports)
if err != nil {
return errors.Wrapf(err, "unable to create Service for %s", commonObjectMeta.Name)
Expand Down Expand Up @@ -2695,8 +2700,14 @@ func (c *Client) CopyFile(localPath string, targetPodName string, targetPath str

// cmdArr will run inside container
cmdArr := []string{"tar", "xf", "-", "-C", targetPath, "--strip", "1"}
err := c.ExecCMDInContainer(targetPodName, cmdArr, nil, nil, reader, false)
if err != nil {
var stdout bytes.Buffer
var stderr bytes.Buffer
err := c.ExecCMDInContainer(targetPodName, cmdArr, &stdout, &stderr, reader, false)
if err != nil {
glog.Errorf("Command '%s' in container failed.\n", strings.Join(cmdArr, " "))
glog.Errorf("stdout: %s\n", stdout.String())
glog.Errorf("stderr: %s\n", stderr.String())
glog.Errorf("err: %s\n", err.Error())
return err
}
return nil
Expand Down