OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package logger | 4 package logger |
5 | 5 |
6 import ( | 6 import ( |
7 "github.com/juju/loggo" | 7 "github.com/juju/loggo" |
8 | 8 |
9 "launchpad.net/juju-core/state" | 9 "launchpad.net/juju-core/state" |
10 "launchpad.net/juju-core/state/api/params" | 10 "launchpad.net/juju-core/state/api/params" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // NotifyWatchers have no state to transmit. | 60 // NotifyWatchers have no state to transmit. |
61 if _, ok := <-watch.Changes(); ok { | 61 if _, ok := <-watch.Changes(); ok { |
62 result[i].NotifyWatcherId = api.resources.Regist
er(watch) | 62 result[i].NotifyWatcherId = api.resources.Regist
er(watch) |
63 err = nil | 63 err = nil |
64 } else { | 64 } else { |
65 err = watcher.MustErr(watch) | 65 err = watcher.MustErr(watch) |
66 } | 66 } |
67 } | 67 } |
68 result[i].Error = common.ServerError(err) | 68 result[i].Error = common.ServerError(err) |
69 } | 69 } |
70 » return params.NotifyWatchResults{result} | 70 » return params.NotifyWatchResults{Results: result} |
71 } | 71 } |
72 | 72 |
73 // LoggingConfig reports the logging configuration for the agents specified. | 73 // LoggingConfig reports the logging configuration for the agents specified. |
74 func (api *LoggerAPI) LoggingConfig(arg params.Entities) params.StringResults { | 74 func (api *LoggerAPI) LoggingConfig(arg params.Entities) params.StringResults { |
75 if len(arg.Entities) == 0 { | 75 if len(arg.Entities) == 0 { |
76 return params.StringResults{} | 76 return params.StringResults{} |
77 } | 77 } |
78 results := make([]params.StringResult, len(arg.Entities)) | 78 results := make([]params.StringResult, len(arg.Entities)) |
79 config, configErr := api.state.EnvironConfig() | 79 config, configErr := api.state.EnvironConfig() |
80 for i, entity := range arg.Entities { | 80 for i, entity := range arg.Entities { |
81 err := common.ErrPerm | 81 err := common.ErrPerm |
82 if api.authorizer.AuthOwner(entity.Tag) { | 82 if api.authorizer.AuthOwner(entity.Tag) { |
83 if configErr == nil { | 83 if configErr == nil { |
84 results[i].Result = config.LoggingConfig() | 84 results[i].Result = config.LoggingConfig() |
85 err = nil | 85 err = nil |
86 } else { | 86 } else { |
87 err = configErr | 87 err = configErr |
88 } | 88 } |
89 } | 89 } |
90 results[i].Error = common.ServerError(err) | 90 results[i].Error = common.ServerError(err) |
91 } | 91 } |
92 » return params.StringResults{results} | 92 » return params.StringResults{Results: results} |
93 } | 93 } |
OLD | NEW |