~themue/juju-core/053-env-more-script-friendly

« back to all changes in this revision

Viewing changes to cmd/jujud/agent.go

Merge trunk and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
                select {
72
72
                case info := <-done:
73
73
                        if info.err != nil {
74
 
                                log.Errorf("cmd/jujud: %s: %v", tasks[info.index], info.err)
 
74
                                log.Errorf("%s: %v", tasks[info.index], info.err)
75
75
                                logged[info.index] = true
76
76
                                err = info.err
77
77
                                break waiting
85
85
        for i, t := range tasks {
86
86
                err1 := t.Stop()
87
87
                if !logged[i] && err1 != nil {
88
 
                        log.Errorf("cmd/jujud: %s: %v", t, err1)
 
88
                        log.Errorf("%s: %v", t, err1)
89
89
                        logged[i] = true
90
90
                }
91
91
                if moreImportant(err1, err) {
131
131
// runLoop repeatedly calls runOnce until it returns worker.ErrTerminateAgent
132
132
// or an upgraded error, or a value is received on stop.
133
133
func runLoop(runOnce func() error, stop <-chan struct{}) error {
134
 
        log.Noticef("cmd/jujud: agent starting")
 
134
        log.Noticef("agent starting")
135
135
        for {
136
136
                err := runOnce()
137
137
                if err == worker.ErrTerminateAgent {
138
 
                        log.Noticef("cmd/jujud: entity is terminated")
 
138
                        log.Noticef("entity is terminated")
139
139
                        return nil
140
140
                }
141
141
                if isFatal(err) {
142
142
                        return err
143
143
                }
144
144
                if err == nil {
145
 
                        log.Errorf("cmd/jujud: agent died with no error")
 
145
                        log.Errorf("agent died with no error")
146
146
                } else {
147
 
                        log.Errorf("cmd/jujud: %v", err)
 
147
                        log.Errorf("%v", err)
148
148
                }
149
149
                if !isleep(retryDelay, stop) {
150
150
                        return nil
151
151
                }
152
 
                log.Noticef("cmd/jujud: rerunning agent")
 
152
                log.Noticef("rerunning agent")
153
153
        }
154
154
        panic("unreachable")
155
155
}