Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#1851 from BenTheElder/outputlines
Browse files Browse the repository at this point in the history
remove unnecessary usage of CombinedOutputLines
  • Loading branch information
k8s-ci-robot committed Sep 15, 2020
2 parents 3355a40 + f9db81c commit 1b4b217
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/build/nodeimage/build_impl.go
Expand Up @@ -166,7 +166,7 @@ func (c *buildContext) prePullImages(bits kube.Bits, dir, containerID string) ([

// get the Kubernetes version we installed on the node
// we need this to ask kubeadm what images we need
rawVersion, err := exec.CombinedOutputLines(cmder.Command("cat", kubernetesVersionLocation))
rawVersion, err := exec.OutputLines(cmder.Command("cat", kubernetesVersionLocation))
if err != nil {
c.logger.Errorf("Image build Failed! Failed to get Kubernetes version: %v", err)
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/nodeimage/internal/container/docker/image.go
Expand Up @@ -70,7 +70,7 @@ func ImageInspect(containerNameOrID, format string) ([]string, error) {
containerNameOrID, // ... against the container
)

return exec.CombinedOutputLines(cmd)
return exec.OutputLines(cmd)
}

// ImageID return the Id of the container image
Expand Down
3 changes: 1 addition & 2 deletions pkg/build/nodeimage/internal/container/docker/run.go
Expand Up @@ -28,6 +28,5 @@ func Run(image string, runArgs []string, containerArgs []string) error {
args = append(args, image)
args = append(args, containerArgs...)
cmd := exec.Command("docker", args...)
_, err := exec.CombinedOutputLines(cmd)
return err
return cmd.Run()
}
2 changes: 1 addition & 1 deletion pkg/build/nodeimage/internal/kube/source.go
Expand Up @@ -59,7 +59,7 @@ func sourceVersion(kubeRoot string) (string, error) {
shellescape.Quote(kubeRoot),
),
)
output, err := exec.CombinedOutputLines(cmd)
output, err := exec.OutputLines(cmd)
if err != nil {
return "", err
}
Expand Down
Expand Up @@ -93,7 +93,7 @@ func waitForReady(node nodes.Node, until time.Time) bool {
// to true.
"-o=jsonpath='{.items..status.conditions[-1:].status}'",
)
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/internal/providers/docker/provision.go
Expand Up @@ -310,7 +310,7 @@ func getProxyEnv(cfg *config.Cluster, networkName string, nodeNames []string) (m
func getSubnets(networkName string) ([]string, error) {
format := `{{range (index (index . "IPAM") "Config")}}{{index . "Subnet"}} {{end}}`
cmd := exec.Command("docker", "network", "inspect", "-f", format, networkName)
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return nil, errors.Wrap(err, "failed to get subnets")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/internal/providers/docker/util.go
Expand Up @@ -35,7 +35,7 @@ func IsAvailable() bool {
// usernsRemap checks if userns-remap is enabled in dockerd
func usernsRemap() bool {
cmd := exec.Command("docker", "info", "--format", "'{{json .SecurityOptions}}'")
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return false
}
Expand All @@ -51,7 +51,7 @@ func usernsRemap() bool {
func mountDevMapper() bool {
storage := ""
cmd := exec.Command("docker", "info", "-f", "{{.Driver}}")
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/internal/providers/podman/provision.go
Expand Up @@ -268,7 +268,7 @@ func getProxyEnv(cfg *config.Cluster) (map[string]string, error) {
func getSubnets(networkName string) ([]string, error) {
format := `{{range (index (index . "IPAM") "Config")}}{{index . "Subnet"}} {{end}}`
cmd := exec.Command("podman", "network", "inspect", "-f", format, networkName)
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return nil, errors.Wrap(err, "failed to get subnets")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/internal/providers/podman/util.go
Expand Up @@ -38,7 +38,7 @@ func IsAvailable() bool {

func getPodmanVersion() (*version.Version, error) {
cmd := exec.Command("podman", "--version")
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/nodeutils/util.go
Expand Up @@ -32,7 +32,7 @@ import (
func KubeVersion(n nodes.Node) (version string, err error) {
// grab kubernetes version from the node image
cmd := n.Command("cat", "/kind/version")
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return "", errors.Wrap(err, "failed to get file")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/kind/load/docker-image/docker-image.go
Expand Up @@ -180,7 +180,7 @@ func imageID(containerNameOrID string) (string, error) {
"-f", "{{ .Id }}",
containerNameOrID, // ... against the container
)
lines, err := exec.CombinedOutputLines(cmd)
lines, err := exec.OutputLines(cmd)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 1b4b217

Please sign in to comment.