~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/environ/wait.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
// It never takes responsibility for the supplied watcher; the client remains
31
31
// responsible for detecting and handling any watcher errors that may occur,
32
32
// whether this func succeeds or fails.
33
 
func WaitForEnviron(w watcher.NotifyWatcher, getter ConfigGetter, abort <-chan struct{}) (environs.Environ, error) {
 
33
func WaitForEnviron(
 
34
        w watcher.NotifyWatcher,
 
35
        getter ConfigGetter,
 
36
        newEnviron NewEnvironFunc,
 
37
        abort <-chan struct{},
 
38
) (environs.Environ, error) {
34
39
        for {
35
40
                select {
36
41
                case <-abort:
43
48
                        if err != nil {
44
49
                                return nil, errors.Annotate(err, "cannot read environ config")
45
50
                        }
46
 
                        environ, err := environs.New(config)
 
51
                        environ, err := newEnviron(config)
47
52
                        if err == nil {
48
53
                                return environ, nil
49
54
                        }