Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(42)

Side by Side Diff: cmd/jujud/unit.go

Issue 8658045: cmd/juju: log when the command finishes
Patch Set: cmd/juju: log when the command finishes Created 10 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cmd/jujud/machine.go ('k') | cmd/supercommand.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "launchpad.net/gnuflag" 5 "launchpad.net/gnuflag"
6 "launchpad.net/juju-core/cmd" 6 "launchpad.net/juju-core/cmd"
7 "launchpad.net/juju-core/log"
8 "launchpad.net/juju-core/state" 7 "launchpad.net/juju-core/state"
9 "launchpad.net/juju-core/worker/uniter" 8 "launchpad.net/juju-core/worker/uniter"
10 "launchpad.net/tomb" 9 "launchpad.net/tomb"
11 ) 10 )
12 11
13 // UnitAgent is a cmd.Command responsible for running a unit agent. 12 // UnitAgent is a cmd.Command responsible for running a unit agent.
14 type UnitAgent struct { 13 type UnitAgent struct {
15 cmd.CommandBase 14 cmd.CommandBase
16 tomb tomb.Tomb 15 tomb tomb.Tomb
17 Conf AgentConf 16 Conf AgentConf
(...skipping 28 matching lines...) Expand all
46 func (a *UnitAgent) Stop() error { 45 func (a *UnitAgent) Stop() error {
47 a.tomb.Kill(nil) 46 a.tomb.Kill(nil)
48 return a.tomb.Wait() 47 return a.tomb.Wait()
49 } 48 }
50 49
51 // Run runs a unit agent. 50 // Run runs a unit agent.
52 func (a *UnitAgent) Run(ctx *cmd.Context) error { 51 func (a *UnitAgent) Run(ctx *cmd.Context) error {
53 if err := a.Conf.read(state.UnitTag(a.UnitName)); err != nil { 52 if err := a.Conf.read(state.UnitTag(a.UnitName)); err != nil {
54 return err 53 return err
55 } 54 }
56 defer log.Noticef("unit agent exiting")
57 defer a.tomb.Done() 55 defer a.tomb.Done()
58 err := RunAgentLoop(a.Conf.Conf, a) 56 err := RunAgentLoop(a.Conf.Conf, a)
59 if ug, ok := err.(*UpgradeReadyError); ok { 57 if ug, ok := err.(*UpgradeReadyError); ok {
60 if err1 := ug.ChangeAgentTools(); err1 != nil { 58 if err1 := ug.ChangeAgentTools(); err1 != nil {
61 err = err1 59 err = err1
62 // Return and let upstart deal with the restart. 60 // Return and let upstart deal with the restart.
63 } 61 }
64 } 62 }
65 return err 63 return err
66 } 64 }
(...skipping 16 matching lines...) Expand all
83 return st.Unit(a.UnitName) 81 return st.Unit(a.UnitName)
84 } 82 }
85 83
86 func (a *UnitAgent) Tag() string { 84 func (a *UnitAgent) Tag() string {
87 return state.UnitTag(a.UnitName) 85 return state.UnitTag(a.UnitName)
88 } 86 }
89 87
90 func (a *UnitAgent) Tomb() *tomb.Tomb { 88 func (a *UnitAgent) Tomb() *tomb.Tomb {
91 return &a.tomb 89 return &a.tomb
92 } 90 }
OLDNEW
« no previous file with comments | « cmd/jujud/machine.go ('k') | cmd/supercommand.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b