summaryrefslogtreecommitdiff
path: root/execdriver/lxc/info.go
diff options
context:
space:
mode:
Diffstat (limited to 'execdriver/lxc/info.go')
-rw-r--r--execdriver/lxc/info.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/execdriver/lxc/info.go b/execdriver/lxc/info.go
deleted file mode 100644
index 3b2ea0d07f..0000000000
--- a/execdriver/lxc/info.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package lxc
-
-import (
- "bufio"
- "errors"
- "strconv"
- "strings"
-)
-
-var (
- ErrCannotParse = errors.New("cannot parse raw input")
-)
-
-type lxcInfo struct {
- Running bool
- Pid int
-}
-
-func parseLxcInfo(raw string) (*lxcInfo, error) {
- if raw == "" {
- return nil, ErrCannotParse
- }
- var (
- err error
- s = bufio.NewScanner(strings.NewReader(raw))
- info = &lxcInfo{}
- )
- for s.Scan() {
- text := s.Text()
-
- if s.Err() != nil {
- return nil, s.Err()
- }
-
- parts := strings.Split(text, ":")
- if len(parts) < 2 {
- continue
- }
- switch strings.TrimSpace(parts[0]) {
- case "state":
- info.Running = strings.TrimSpace(parts[1]) == "RUNNING"
- case "pid":
- info.Pid, err = strconv.Atoi(strings.TrimSpace(parts[1]))
- if err != nil {
- return nil, err
- }
- }
- }
- return info, nil
-}