summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-08-29 19:17:46 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-08-29 19:17:46 +0000
commit55ccfdc79fbc77ebb802df6cfbcd1b573ca9adc9 (patch)
tree2f549cb1323fbc0cd81e345b6c17cb34a7c9e7db
parent27fd1826fbd6860d147c7ec955b28c9a0bf40eae (diff)
downloadbcfg2-55ccfdc79fbc77ebb802df6cfbcd1b573ca9adc9.tar.gz
bcfg2-55ccfdc79fbc77ebb802df6cfbcd1b573ca9adc9.tar.bz2
bcfg2-55ccfdc79fbc77ebb802df6cfbcd1b573ca9adc9.zip
Implement service removal for smf/lrc services
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2140 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Client/Solaris.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/Client/Solaris.py b/src/lib/Client/Solaris.py
index 7e3bedb35..cc2f0627b 100644
--- a/src/lib/Client/Solaris.py
+++ b/src/lib/Client/Solaris.py
@@ -2,6 +2,7 @@
'''This provides bcfg2 support for Solaris'''
__revision__ = '$Revision$'
+import os
from glob import glob
from os import stat, unlink
from re import compile as regcompile
@@ -89,7 +90,7 @@ class ToolsetImpl(Toolset):
else:
self.logger.info('Failed to locate FMRI for service %s' % entry.get('name'))
return False
- if entry.get('FMRI')[:3] == 'lrc':
+ if entry.get('FMRI').startswith('lrc'):
filename = entry.get('FMRI').split('/')[-1]
# this is a legacy service
gname = "/etc/rc*.d/%s" % filename
@@ -125,6 +126,16 @@ class ToolsetImpl(Toolset):
if self.setup['dryrun']:
print "Disabling Service %s" % (entry.get('name'))
else:
+ if entry.get("FMRI").startswith('lrc'):
+ try:
+ loc = entry.get("FMRI")[4:].replace('_', ',')
+ self.logger.debug("Renaming file %s to %s" % \
+ (loc, loc.replace('/S', '/DISABLED')))
+ os.rename(loc, loc.replace('/S', '/DISABLED'))
+ return True
+ except OSError:
+ self.logger.error("Failed to rename init script %s" % (loc))
+ return False
cmdrc = self.saferun("/usr/sbin/svcadm disable -r %s" % (entry.attrib['FMRI']))[0]
else:
if self.setup['dryrun']: