summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-08-29 19:24:49 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-08-29 19:24:49 +0000
commitf7e4ccb9b3c95adaf6e474395b268a5b9a322535 (patch)
tree056314fb5b431b733daa9200f2e50087236bbd47 /src/lib
parent55ccfdc79fbc77ebb802df6cfbcd1b573ca9adc9 (diff)
downloadbcfg2-f7e4ccb9b3c95adaf6e474395b268a5b9a322535.tar.gz
bcfg2-f7e4ccb9b3c95adaf6e474395b268a5b9a322535.tar.bz2
bcfg2-f7e4ccb9b3c95adaf6e474395b268a5b9a322535.zip
Make service restarts tunable across platforms
* Remove hardcoded /etc/init.d calls in Toolset.py * Add an overloadable method * Implement the method for Solaris.py git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2141 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Client/Solaris.py8
-rw-r--r--src/lib/Client/Toolset.py9
2 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/Client/Solaris.py b/src/lib/Client/Solaris.py
index cc2f0627b..36f59c1d1 100644
--- a/src/lib/Client/Solaris.py
+++ b/src/lib/Client/Solaris.py
@@ -223,3 +223,11 @@ class ToolsetImpl(Toolset):
unlink(self.noaskname)
except:
pass
+
+ def RestartService(self, service):
+ '''Restart a service'''
+ if service.get("FMRI").startswith('lrc'):
+ Toolset.RestartService(self, service)
+ else:
+ self.logger.debug("Restarting service %s" % (service.get("FMRI")))
+ self.saferun("svcadm disable %s" % (service.get("FMRI"))
diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py
index 7aa6a420f..3861233b2 100644
--- a/src/lib/Client/Toolset.py
+++ b/src/lib/Client/Toolset.py
@@ -530,8 +530,7 @@ class Toolset(object):
# stop services in miniroot
self.saferun('/etc/init.d/%s stop' % svc.get('name'))
else:
- self.logger.debug('Restarting service %s' % svc.get('name'))
- self.saferun('/etc/init.d/%s %s' % (svc.get('name'), svc.get('reload', 'reload')))
+ self.RestartService(svc)
for entry in self.structures:
if [strent for strent in entry.getchildren() if not self.states.get(strent, False)]:
@@ -693,3 +692,9 @@ class Toolset(object):
self.modified.append(entry)
left = len(work) + len(self.pkgwork['remove'])
self.HandleBundleDeps()
+
+ def RestartService(self, entry):
+ '''Restart a service entry'''
+ self.logger.debug('Restarting service %s' % entry.get('name'))
+ self.saferun('/etc/init.d/%s %s' % (entry.get('name'), entry.get('reload', 'reload')))
+