summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Tools
diff options
context:
space:
mode:
authorRobert Gogolok <gogo@cs.uni-sb.de>2008-05-08 17:26:08 +0000
committerRobert Gogolok <gogo@cs.uni-sb.de>2008-05-08 17:26:08 +0000
commit52e626a6f3979137337697f6892c12ad31a85ef0 (patch)
treeac2599db0d9a8734fb40b52f12ade0c4817f203e /src/lib/Client/Tools
parent3d054585fab3919a7f61ac7776e3b3d0cf5fc71a (diff)
downloadbcfg2-52e626a6f3979137337697f6892c12ad31a85ef0.tar.gz
bcfg2-52e626a6f3979137337697f6892c12ad31a85ef0.tar.bz2
bcfg2-52e626a6f3979137337697f6892c12ad31a85ef0.zip
- Add preliminary support for rc under FreeBSD
- TODOs git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4602 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Tools')
-rw-r--r--src/lib/Client/Tools/FreeBSDInit.py34
-rw-r--r--src/lib/Client/Tools/FreeBSDPackage.py6
-rw-r--r--src/lib/Client/Tools/__init__.py4
3 files changed, 41 insertions, 3 deletions
diff --git a/src/lib/Client/Tools/FreeBSDInit.py b/src/lib/Client/Tools/FreeBSDInit.py
new file mode 100644
index 000000000..8e13e7981
--- /dev/null
+++ b/src/lib/Client/Tools/FreeBSDInit.py
@@ -0,0 +1,34 @@
+'''FreeBSD Init Support for Bcfg2'''
+__revision__ = '$Rev$'
+
+# TODO
+# - hardcoded path to ports rc.d
+# - doesn't know about /etc/rc.d/
+
+import Bcfg2.Client.Tools
+
+class FreeBSDInit(Bcfg2.Client.Tools.SvcTool):
+ '''FreeBSD Service Support for Bcfg2'''
+ __name__ = 'FreeBSDInit'
+ __handles__ = [('Service', 'freebsd')]
+ __req__ = {'Service': ['name', 'status']}
+ __svcrestart__ = 'restart'
+
+ def VerifyService(self, entry, _):
+ return True
+
+ def BundleUpdated(self, bundle, states):
+ '''The Bundle has been updated'''
+ for entry in bundle:
+ if self.handlesEntry(entry):
+ command = "/usr/local/etc/rc.d/%s" % entry.get('name')
+ if entry.get('status') == 'on' and not self.setup['build']:
+ self.logger.debug('Restarting service %s' % entry.get('name'))
+ rc = self.cmd.run('%s %s' % (command, \
+ entry.get('reload', self.__svcrestart__)))[0]
+ else:
+ self.logger.debug('Stopping service %s' % entry.get('name'))
+ rc = self.cmd.run('%s stop' % command)[0]
+ if rc:
+ self.logger.error("Failed to restart service %s" % (entry.get('name')))
+
diff --git a/src/lib/Client/Tools/FreeBSDPackage.py b/src/lib/Client/Tools/FreeBSDPackage.py
index 0e8747e8b..b77838f9d 100644
--- a/src/lib/Client/Tools/FreeBSDPackage.py
+++ b/src/lib/Client/Tools/FreeBSDPackage.py
@@ -1,5 +1,9 @@
'''This is the bcfg2 tool for the FreeBSD package system.'''
-__revision__ = '$Id$'
+__revision__ = '$Rev$'
+
+# TODO
+# - actual package installation
+# - verification of package files
import re
import Bcfg2.Client.Tools
diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py
index 4caf1abcd..cda5d83cc 100644
--- a/src/lib/Client/Tools/__init__.py
+++ b/src/lib/Client/Tools/__init__.py
@@ -2,8 +2,8 @@
__revision__ = '$Revision$'
__all__ = ["Action", "APT", "Blast", "Chkconfig", "DebInit", "Encap",
- "FreeBSDPackage", "launchd", "Portage", "POSIX", "RPM",
- "RPMng", 'rpmtools', "RcUpdate", "SMF", "SYSV", "Yum",
+ "FreeBSDInit", "FreeBSDPackage", "launchd", "Portage", "POSIX",
+ "RPM", "RPMng", 'rpmtools', "RcUpdate", "SMF", "SYSV", "Yum",
"YUMng"]
drivers = [item for item in __all__ if item not in ['rpmtools']]