~dave-cheney/juju-core/102-cmd-init-context

« back to all changes in this revision

Viewing changes to cmd/juju/deploy.go

  • Committer: Dave Cheney
  • Date: 2012-09-17 15:23:08 UTC
  • mfrom: (507.1.7 096-cmd-config-var)
  • Revision ID: david.cheney@canonical.com-20120917152308-vlt0nvcq4gwl6oj2
cmd: add FileVar flag and use it

PyJuJu had a nice construct that allowed a flag that was a file, or more
specifically the contents of a file to be handled nicely. As deploy ended
up implementing this, and I need it now for juju set, it made sense to 
pretty it up.

R=niemeyer
CC=
https://codereview.appspot.com/6490121

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
        EnvName      string
14
14
        CharmName    string
15
15
        ServiceName  string
16
 
        ConfPath     string
 
16
        Config       cmd.FileVar
17
17
        NumUnits     int // defaults to 1
18
18
        BumpRevision bool
19
19
        RepoPath     string // defaults to JUJU_REPOSITORY
52
52
        f.IntVar(&c.NumUnits, "num-units", 1, "")
53
53
        f.BoolVar(&c.BumpRevision, "u", false, "increment local charm directory revision")
54
54
        f.BoolVar(&c.BumpRevision, "upgrade", false, "")
55
 
        f.StringVar(&c.ConfPath, "config", "", "path to yaml-formatted service config")
 
55
        f.Var(&c.Config, "config", "path to yaml-formatted service config")
56
56
        f.StringVar(&c.RepoPath, "repository", os.Getenv("JUJU_REPOSITORY"), "local charm repository")
57
57
        // TODO --constraints
58
58
        if err := f.Parse(true, args); err != nil {
98
98
        if err != nil {
99
99
                return err
100
100
        }
101
 
        if c.ConfPath != "" {
 
101
        if c.Config.ReadCloser != nil {
102
102
                // TODO many dependencies :(
103
103
                return errors.New("state.Service.SetConfig not implemented (format 2...)")
104
104
        }