~agx/cloud-init/sles12

« back to all changes in this revision

Viewing changes to cloudinit/cloud.py

  • Committer: Scott Moser
  • Date: 2015-08-07 19:45:01 UTC
  • mfrom: (1130.1.32 trunk.reporting)
  • Revision ID: smoser@ubuntu.com-20150807194501-z582089k6n21rmmp
Add initial reporting module and events

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import os
25
25
 
26
26
from cloudinit import log as logging
 
27
from cloudinit import reporting
27
28
 
28
29
LOG = logging.getLogger(__name__)
29
30
 
40
41
 
41
42
 
42
43
class Cloud(object):
43
 
    def __init__(self, datasource, paths, cfg, distro, runners):
 
44
    def __init__(self, datasource, paths, cfg, distro, runners, reporter=None):
44
45
        self.datasource = datasource
45
46
        self.paths = paths
46
47
        self.distro = distro
47
48
        self._cfg = cfg
48
49
        self._runners = runners
 
50
        if reporter is None:
 
51
            reporter = reporting.ReportEventStack(
 
52
                name="unnamed-cloud-reporter",
 
53
                description="unnamed-cloud-reporter",
 
54
                reporting_enabled=False)
 
55
        self.reporter = reporter
49
56
 
50
57
    # If a 'user' manipulates logging or logging services
51
58
    # it is typically useful to cause the logging to be