summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Client/Tools/Chkconfig.py
diff options
context:
space:
mode:
authorMichael Fenn <fennm@deshawresearch.com>2013-05-06 19:09:28 -0400
committerMichael Fenn <fennm@deshawresearch.com>2013-05-06 19:14:48 -0400
commitf9fd18bd1089f7edd7ca6048e000c45375250eaa (patch)
tree9c2713dc4c750ea6d3d1fe50e4fa42472ad2b474 /src/lib/Bcfg2/Client/Tools/Chkconfig.py
parent3d60058e1361ece220964d6e25245b6cf3a1e6e1 (diff)
downloadbcfg2-f9fd18bd1089f7edd7ca6048e000c45375250eaa.tar.gz
bcfg2-f9fd18bd1089f7edd7ca6048e000c45375250eaa.tar.bz2
bcfg2-f9fd18bd1089f7edd7ca6048e000c45375250eaa.zip
make chkconfig tool driver respect servicemode
The bcfg2 man page states that -s disabled should stop bcfg2 from attempting to modify any services, but the Chkconfig driver (at least) does start the service during the Install phase even with -s disabled. This patch adds support to the Chkconfig driver for the servicemode config parameter. It still does chkconfig --add, which I think makes sense to happen as part of configuration, but it does not attempt to actually start the service.
Diffstat (limited to 'src/lib/Bcfg2/Client/Tools/Chkconfig.py')
-rw-r--r--src/lib/Bcfg2/Client/Tools/Chkconfig.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/Chkconfig.py b/src/lib/Bcfg2/Client/Tools/Chkconfig.py
index ec7f462b3..b1f0b6fa1 100644
--- a/src/lib/Bcfg2/Client/Tools/Chkconfig.py
+++ b/src/lib/Bcfg2/Client/Tools/Chkconfig.py
@@ -65,16 +65,18 @@ class Chkconfig(Bcfg2.Client.Tools.SvcTool):
self.cmd.run("/sbin/chkconfig --add %s" % (entry.attrib['name']))
self.logger.info("Installing Service %s" % (entry.get('name')))
rv = True
- if entry.get('status') == 'off':
+ if entry.get('status') == 'off' or self.setup["servicemode"] == "build":
rv &= self.cmd.run((rcmd + " --level 0123456") %
(entry.get('name'),
entry.get('status'))).success
- if entry.get("current_status") == "on":
+ if entry.get("current_status") == "on" and \
+ self.setup["servicemode"] != "disabled":
rv &= self.stop_service(entry).success
else:
rv &= self.cmd.run(rcmd % (entry.get('name'),
entry.get('status'))).success
- if entry.get("current_status") == "off":
+ if entry.get("current_status") == "off" and \
+ self.setup["servicemode"] != "disabled":
rv &= self.start_service(entry).success
return rv