~devel-sumpfralle/virtualbrick/nitpicking

« back to all changes in this revision

Viewing changes to virtualbricks/events.py

  • Committer: Marco Giusti
  • Date: 2013-06-18 17:22:17 UTC
  • Revision ID: marco.giusti@gmail.com-20130618172217-17cuhx5e3pwmw2c3
Ignore all trial temp directories

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from twisted.internet import reactor, defer
20
20
 
21
 
from virtualbricks import base, errors, console, log
 
21
from virtualbricks import base, errors, console, _compat
22
22
 
23
23
 
24
24
if False:  # pyflakes
25
25
    _ = str
26
26
 
27
27
 
28
 
process_ended = log.Event("Process ended with exit code {code}")
29
 
event_error = log.Event("Error in event action. See the log for more "
30
 
                        "informations")
 
28
log = _compat.getLogger(__name__)
31
29
 
32
30
 
33
31
class Command(base.String):
131
129
    def do_actions(self, deferred):
132
130
 
133
131
        def log_err(results):
134
 
            for success, status in results:
 
132
            for success, value in results:
135
133
                if success:
136
 
                    self.logger.info(process_ended, code=status)
 
134
                    log.msg("Process ended with exit code %s" % value)
137
135
                else:
138
 
                    self.logger.error(event_error, log_failure=status)
 
136
                    log.err(value, "Error in event action. See the log for "
 
137
                            "more informations")
139
138
            return self
140
139
 
141
140
        self.scheduled = None