root/trunk/bcfg2/src/lib/Client/Tools/FreeBSDInit.py

Revision 5430, 0.7 KB (checked in by solj, 2 months ago)

FreeBSDInit: Add check to see if we are on a FreeBSD system

Signed-off-by: Sol Jerome <solj@…>

  • Property svn:keywords set to Rev
Line 
1'''FreeBSD Init Support for Bcfg2'''
2__revision__ = '$Rev$'
3
4# TODO
5# - hardcoded path to ports rc.d
6# - doesn't know about /etc/rc.d/
7
8import os
9import Bcfg2.Client.Tools
10
11class FreeBSDInit(Bcfg2.Client.Tools.SvcTool):
12    '''FreeBSD Service Support for Bcfg2'''
13    name = 'FreeBSDInit'
14    __handles__ = [('Service', 'freebsd')]
15    __req__ = {'Service': ['name', 'status']}
16
17    def __init__(self, logger, cfg, setup):
18        if os.uname()[0] != 'FreeBSD':
19            raise Bcfg2.Client.Tools.toolInstantiationError
20
21    def VerifyService(self, entry, _):
22        return True
23
24    def get_svc_command(self, service, action):
25        return "/usr/local/etc/rc.d/%s %s" % (service.get('name'), action)
Note: See TracBrowser for help on using the browser.