Clean integration-cli/utils.go from most of its content

Most of the code is now on pkg/integration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: def13fa23c812d367e3c61d9c39bdcee66929c17
Component: engine
This commit is contained in:
Vincent Demeester
2016-12-13 21:21:51 +01:00
parent eed726f2d1
commit 2f9b83d720
23 changed files with 210 additions and 269 deletions

View File

@ -1,13 +1,8 @@
package main
import (
"io"
"os"
"os/exec"
"time"
"github.com/docker/docker/pkg/integration"
"github.com/docker/docker/pkg/integration/cmd"
"os/exec"
)
func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
@ -23,18 +18,6 @@ func runCommandWithOutput(execCmd *exec.Cmd) (string, int, error) {
return result.Combined(), result.ExitCode, result.Error
}
// TODO: update code to call cmd.RunCmd directly, and remove this function
func runCommandWithStdoutStderr(execCmd *exec.Cmd) (string, string, int, error) {
result := cmd.RunCmd(transformCmd(execCmd))
return result.Stdout(), result.Stderr(), result.ExitCode, result.Error
}
// TODO: update code to call cmd.RunCmd directly, and remove this function
func runCommand(execCmd *exec.Cmd) (exitCode int, err error) {
result := cmd.RunCmd(transformCmd(execCmd))
return result.ExitCode, result.Error
}
// Temporary shim for migrating commands to the new function
func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
return cmd.Cmd{
@ -45,35 +28,3 @@ func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
Stdout: execCmd.Stdout,
}
}
func runCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err error) {
return integration.RunCommandPipelineWithOutput(cmds...)
}
func convertSliceOfStringsToMap(input []string) map[string]struct{} {
return integration.ConvertSliceOfStringsToMap(input)
}
func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error {
return integration.CompareDirectoryEntries(e1, e2)
}
func listTar(f io.Reader) ([]string, error) {
return integration.ListTar(f)
}
func randomTmpDirPath(s string, platform string) string {
return integration.RandomTmpDirPath(s, platform)
}
func consumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error) {
return integration.ConsumeWithSpeed(reader, chunkSize, interval, stop)
}
func parseCgroupPaths(procCgroupData string) map[string]string {
return integration.ParseCgroupPaths(procCgroupData)
}
func runAtDifferentDate(date time.Time, block func()) {
integration.RunAtDifferentDate(date, block)
}