diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-08-29 19:59:58 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-08-29 19:59:58 +0000 |
commit | 62160aa444ff7c2bef9ebc7629ac52217e7427e3 (patch) | |
tree | 388d1867623a5a63f8d0a28002e4c40d3da31cbf /src/lib/Client | |
parent | 33b7d4b4537a3154b83f47b49352b8619ee5d653 (diff) | |
download | bcfg2-62160aa444ff7c2bef9ebc7629ac52217e7427e3.tar.gz bcfg2-62160aa444ff7c2bef9ebc7629ac52217e7427e3.tar.bz2 bcfg2-62160aa444ff7c2bef9ebc7629ac52217e7427e3.zip |
Only restart enabled services
Fix lrc services in the enable mode
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2144 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client')
-rw-r--r-- | src/lib/Client/Solaris.py | 16 | ||||
-rw-r--r-- | src/lib/Client/Toolset.py | 5 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/Client/Solaris.py b/src/lib/Client/Solaris.py index 9cfdc7458..10464de78 100644 --- a/src/lib/Client/Solaris.py +++ b/src/lib/Client/Solaris.py @@ -94,9 +94,13 @@ class ToolsetImpl(Toolset): filename = entry.get('FMRI').split('/')[-1] # this is a legacy service gname = "/etc/rc*.d/%s" % filename - if glob(gname.replace('_', '.')): + files = glob(gname.replace('_', '.')) + if files: + self.logger.debug("Matched %s with %s" % \ + (entry.get("FMRI"), ":".join(files))) return entry.get('status') == 'on' else: + self.logger.debug("No service matching %s" % (entry.get("FMRI"))) return entry.get('status') == 'off' try: srvdata = self.saferun("/usr/bin/svcs -H -o STA %s" % entry.attrib['name'])[1][0].split() @@ -141,7 +145,10 @@ class ToolsetImpl(Toolset): if self.setup['dryrun']: print "Enabling Service %s" % (entry.attrib['name']) else: - cmdrc = self.saferun("/usr/sbin/svcadm enable -r %s" % (entry.attrib['FMRI']))[0] + if entry.get('FMRI').startswith('lrc'): + pass + else: + cmdrc = self.saferun("/usr/sbin/svcadm enable -r %s" % (entry.attrib['FMRI']))[0] return cmdrc == 0 def VerifyPackage(self, entry, modlist): @@ -229,5 +236,6 @@ class ToolsetImpl(Toolset): if service.get("FMRI").startswith('lrc'): Toolset.RestartService(self, service) else: - self.logger.debug("Restarting service %s" % (service.get("FMRI"))) - self.saferun("svcadm restart %s" % (service.get("FMRI"))) + if entry.get('status') == 'on': + self.logger.debug("Restarting service %s" % (service.get("FMRI"))) + self.saferun("svcadm restart %s" % (service.get("FMRI"))) diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py index 3861233b2..66c32568e 100644 --- a/src/lib/Client/Toolset.py +++ b/src/lib/Client/Toolset.py @@ -695,6 +695,7 @@ class Toolset(object): 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'))) + if entry.get('status') == 'on': + self.logger.debug('Restarting service %s' % entry.get('name')) + self.saferun('/etc/init.d/%s %s' % (entry.get('name'), entry.get('reload', 'reload'))) |