~james-page/ubuntu/wily/juju-core/mir-fixes

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/state/api/common/environwatcher.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-03-28 08:58:42 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20140328085842-cyzrgc120bdfxwj0
Tags: 1.17.7-0ubuntu1
* New upstream point release, including fixes for:
  - no debug log with all providers on Ubuntu 14.04 (LP: #1294776).
* d/control: Add cpu-checker dependency to juju-local (LP: #1297077).

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
        "launchpad.net/juju-core/state/api/watcher"
11
11
)
12
12
 
13
 
// EnvironWatcher provides common client side api functions
14
 
// to call into the apiserver.common.EnvironWatcher.
 
13
// EnvironWatcher provides common client-side API functions
 
14
// to call into apiserver.common.EnvironWatcher.
15
15
type EnvironWatcher struct {
16
 
        façadeName string
 
16
        facadeName string
17
17
        caller     base.Caller
18
18
}
19
19
 
20
 
// NewEnvironWatcher creates a EnvironWatcher on the specified façade,
 
20
// NewEnvironWatcher creates a EnvironWatcher on the specified facade,
21
21
// and uses this name when calling through the caller.
22
 
func NewEnvironWatcher(façadeName string, caller base.Caller) *EnvironWatcher {
23
 
        return &EnvironWatcher{façadeName, caller}
 
22
func NewEnvironWatcher(facadeName string, caller base.Caller) *EnvironWatcher {
 
23
        return &EnvironWatcher{facadeName, caller}
24
24
}
25
25
 
26
26
// WatchForEnvironConfigChanges return a NotifyWatcher waiting for the
27
27
// environment configuration to change.
28
28
func (e *EnvironWatcher) WatchForEnvironConfigChanges() (watcher.NotifyWatcher, error) {
29
29
        var result params.NotifyWatchResult
30
 
        err := e.caller.Call(e.façadeName, "", "WatchForEnvironConfigChanges", nil, &result)
 
30
        err := e.caller.Call(e.facadeName, "", "WatchForEnvironConfigChanges", nil, &result)
31
31
        if err != nil {
32
32
                return nil, err
33
33
        }
34
 
        if err := result.Error; err != nil {
35
 
                return nil, result.Error
36
 
        }
37
 
        w := watcher.NewNotifyWatcher(e.caller, result)
38
 
        return w, nil
 
34
        return watcher.NewNotifyWatcher(e.caller, result), nil
39
35
}
40
36
 
41
37
// EnvironConfig returns the current environment configuration.
42
38
func (e *EnvironWatcher) EnvironConfig() (*config.Config, error) {
43
39
        var result params.EnvironConfigResult
44
 
        err := e.caller.Call(e.façadeName, "", "EnvironConfig", nil, &result)
 
40
        err := e.caller.Call(e.facadeName, "", "EnvironConfig", nil, &result)
45
41
        if err != nil {
46
42
                return nil, err
47
43
        }
48
 
        if err := result.Error; err != nil {
49
 
                return nil, err
50
 
        }
51
44
        conf, err := config.New(config.NoDefaults, result.Config)
52
45
        if err != nil {
53
46
                return nil, err