Adding support for a new distro is relatively straightforward, it basically boils down to:
Lets have a look at the Fedora plugin:
from os.path import exists
import re
from twisted.internet.utils import getProcessValue
from wader.common.oses.linux import LinuxPlugin
from wader.common.utils import get_file_data
class FedoraBasedDistro(LinuxPlugin):
"""
OSPlugin for Fedora-based distros
"""
#XXX: Almost duplicated code with Suse plugin
def get_timezone(self):
timezone_re = re.compile('ZONE="(?P<tzname>[\w/]+)"')
sysconf_clock_file = get_file_data('/etc/sysconfig/clock')
search_dict = timezone_re.search(sysconf_clock_file).groupdict()
return search_dict['tzname']
def is_valid(self):
paths = ['/etc/redhat-release', '/etc/fedora-release']
return any(map(exists, paths))
def update_dns_cache(self):
if exists("/usr/sbin/nscd"):
getProcessValue("/etc/init.d/nscd", ["condrestart"])
getProcessValue("/etc/init.d/nscd", ["-i", "hosts"])
fedora = FedoraBasedDistro()
As we can see, the Fedora plugin just defines is_valid and provides an implementation for get_timezone.
Adding support for a new OS is not as easy as the previous point. You need to add a new os class to wader.common.oses with a working implementation for the following methods/objects: