Skip to content

Commit

Permalink
Merge pull request #85 from amy/master
Browse files Browse the repository at this point in the history
rancher-compose-executor v0.14.18 & catalog install & up envfile multiline
  • Loading branch information
Denise authored Aug 29, 2017
2 parents f30f2a3 + 43bc5a3 commit 6d3423f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 40 deletions.
26 changes: 3 additions & 23 deletions cmd/stack.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package cmd

import (
"bufio"
"bytes"
"io/ioutil"
"os"
"strings"

"github.com/pkg/errors"
"github.com/rancher/go-rancher/v2"
"github.com/rancher/rancher-compose-executor/lookup"
"github.com/urfave/cli"
)

Expand Down Expand Up @@ -145,27 +143,9 @@ func getFile(name string) (string, error) {
}

func parseAnswers(ctx *cli.Context) (map[string]interface{}, error) {
answers := map[string]interface{}{}
answersFile, err := getFile(ctx.String("answers"))
if err != nil {
return nil, err
}

scanner := bufio.NewScanner(bytes.NewBuffer([]byte(answersFile)))
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line == "" || strings.HasPrefix(line, "#") {
continue
}
parts := strings.SplitN(line, "=", 2)
if len(parts) == 1 {
answers[parts[0]] = ""
} else {
answers[parts[0]] = parts[1]
}
}
file := ctx.String("answers")

return answers, scanner.Err()
return lookup.ParseEnvFile(file)
}

func stackCreate(ctx *cli.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ github.com/patrickmn/go-cache 1881a9bccb818787f68c52bfba648c6cf34c34fa
github.com/pkg/errors 1d2e60385a13aaa66134984235061c2f9302520e
github.com/rancher/go-rancher 8416cdbe06e6015287a06425e11598235b73a045
github.com/rancher/rancher-catalog-service a3a8b500adceb82b3a0387b2c7b06a60e7eeee9a
github.com/rancher/rancher-compose-executor v0.14.17
github.com/rancher/rancher-compose-executor v0.14.18
github.com/rancher/rancher-docker-api-proxy 461b5e7022698283030495cf5693680699ce9c28
github.com/Sirupsen/logrus 26709e2714106fb8ad40b773b711ebce25b78914
github.com/spf13/pflag cb88ea77998c3f024757528e3305022ab50b43be
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6d3423f

Please sign in to comment.