summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-12-16 20:33:43 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-12-16 20:33:43 +0000
commit97f27837c96643ff5a16a35c1871a884eee89d93 (patch)
tree5270f9c403c4dddfbc8854bb97e1a28aa0d2de83
parent174e15541bddd1cc3dd720b019cf0950f74a2807 (diff)
downloadbcfg2-97f27837c96643ff5a16a35c1871a884eee89d93.tar.gz
bcfg2-97f27837c96643ff5a16a35c1871a884eee89d93.tar.bz2
bcfg2-97f27837c96643ff5a16a35c1871a884eee89d93.zip
fix nonexistant init script errors
(Logical change 1.163) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@724 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Client/Debian.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Client/Debian.py b/src/lib/Client/Debian.py
index f75b1cca6..4acade73f 100644
--- a/src/lib/Client/Debian.py
+++ b/src/lib/Client/Debian.py
@@ -3,7 +3,7 @@ __revision__ = '$Revision: 1.39 $'
from copy import deepcopy
from glob import glob
-from os import environ, system
+from os import environ, stat, system
from popen2 import Popen4
import apt_pkg
@@ -57,17 +57,22 @@ class Debian(Toolset):
def InstallService(self, entry):
'''Install Service for entry'''
+ cmdrc = 1
self.CondPrint('verbose', "Installing Service %s" % (entry.get('name')))
+ try:
+ stat('/etc/init.d/%s' % entry.get('name'))
+ except OSError:
+ self.CondPrint('debug', "Init script for service %s does not exist" % entry.get('name'))
+ return False
+
if entry.attrib['status'] == 'off':
if self.setup['dryrun']:
print "Disabling service %s" % (entry.get('name'))
- return False
else:
cmdrc = system("update-rc.d -f %s remove" % entry.get('name'))
else:
if self.setup['dryrun']:
print "Enabling service %s" % (entry.attrib['name'])
- return False
else:
cmdrc = system("update-rc.d %s defaults" % (entry.attrib['name']))
if cmdrc: