Below is the file 'client/plugins/debianrelease.py' from this revision. You can also download the file.


# this plugin will log an informational message containing the Debian release
# running on a server; if the machine doesn't run Debian then nothing will be
# returned.

from phonehome import urgency
import os

debian_version_file = '/etc/debian_version'

# source: http://www.debian.org/releases/
version_hash = {
    '3.1' : 'sarge',
    '3.0' : 'woody',
    '2.2' : 'potato',
    '2.1' : 'slink',
    '2.0' : 'hamm'
}

def run():
    results = []
    if os.access(debian_version_file, os.R_OK):
	release = open(debian_version_file).readline()
	release = release.strip()
	results.append((urgency['info'],
			'running debian release: %s (%s)' % (release,
							     version_hash.get(release) or "unknown")))
    return results