1
// Copyright 2012, 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
9
"launchpad.net/juju-core/state/api/params"
10
"launchpad.net/juju-core/state/api/watcher"
13
// Machine represents a juju machine as seen by the deployer worker.
19
// WatchUnits starts a StringsWatcher to watch all units deployed to
20
// the machine, in order to track which ones should be deployed or
22
func (m *Machine) WatchUnits() (*watcher.StringsWatcher, error) {
23
var results params.StringsWatchResults
24
args := params.Entities{
25
Entities: []params.Entity{{Tag: m.tag}},
27
err := m.dstate.caller.Call("Deployer", "", "WatchUnits", args, &results)
31
if len(results.Results) != 1 {
32
return nil, fmt.Errorf("expected one result, got %d", len(results.Results))
34
result := results.Results[0]
35
if result.Error != nil {
36
return nil, result.Error
38
w := watcher.NewStringsWatcher(m.dstate.caller, result)