2
# Copyright (c) 2008 Canonical
4
# Written by Marc Tardif <marc@interunion.ca>
6
# This file is part of Checkbox.
8
# Checkbox is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# Checkbox is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
24
from checkbox.plugin import Plugin
27
class SystemInfo(Plugin):
29
optional_attributes = ["system_id"]
31
def register(self, manager):
32
super(SystemInfo, self).register(manager)
34
# System report should be generated early.
35
self._manager.reactor.call_on("report", self.report, -10)
38
system_id = self._config.system_id or self._persist.get("system_id")
40
system = self._manager.registry.hal.computer.system
44
# Old versions of HAL didn't have the system namespace
45
if "hardware" in system:
46
hardware = system.hardware
50
fingerprint = md5.new()
53
system.info.subsystem,
59
fingerprint.update(str(field))
61
system_id = fingerprint.hexdigest()
62
self._persist.set("system_id", system_id)
65
logging.info("System ID: %s", message)
66
self._manager.reactor.fire("report-system_id", message)