diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2008-09-27 02:20:53 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2008-09-27 02:20:53 +0000 |
commit | 6e8b40a2496bd5c0f531804a210cf6b5ba072ed1 (patch) | |
tree | 56804032259587b28d12e5c7386e56562127b540 /src/lib/Client/Tools/RcUpdate.py | |
parent | 31a81c82a5c8e71a7e355dc1426da10ec6e28a45 (diff) | |
download | bcfg2-6e8b40a2496bd5c0f531804a210cf6b5ba072ed1.tar.gz bcfg2-6e8b40a2496bd5c0f531804a210cf6b5ba072ed1.tar.bz2 bcfg2-6e8b40a2496bd5c0f531804a210cf6b5ba072ed1.zip |
Pylint formatting fixes for client tool drivers
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4923 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Tools/RcUpdate.py')
-rw-r--r-- | src/lib/Client/Tools/RcUpdate.py | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/lib/Client/Tools/RcUpdate.py b/src/lib/Client/Tools/RcUpdate.py index d4fd75168..717099954 100644 --- a/src/lib/Client/Tools/RcUpdate.py +++ b/src/lib/Client/Tools/RcUpdate.py @@ -11,22 +11,29 @@ class RcUpdate(Bcfg2.Client.Tools.SvcTool): __req__ = {'Service': ['name', 'status']} def VerifyService(self, entry, _): - '''Verify Service status for entry. Assumes we run in the "default" runlevel.''' - # mrj - i think this should be: - # rc = self.cmd.run('/bin/rc-status | grep %s | grep started"' % entry.attrib['name']) - # ...but as i can't figure out a way to test that right now, i'll do the one - # that works in python's interactive interpreter. + ''' + Verify Service status for entry. + Assumes we run in the "default" runlevel. + ''' + # mrj - i think this should be: + # rc = self.cmd.run('/bin/rc-status | \ + # grep %s | \ + # grep started"' % entry.attrib['name']) + # + # ...but as i can't figure out a way to + # test that right now, i'll do the one + # that works in python's interactive interpreter. rc = commands.getoutput('/bin/rc-status | grep %s | grep started' % \ entry.get('name')) status = len(rc) > 0 - + if not status: - # service is off + # service is off if entry.get('status') == 'on': - # we want it on, it's not + # we want it on, it's not entry.set('current_status', 'off') else: - # we want it off, it's not + # we want it off, it's not entry.set('current_status', 'on') return status @@ -36,14 +43,17 @@ class RcUpdate(Bcfg2.Client.Tools.SvcTool): try: os.stat('/etc/init.d/%s' % entry.get('name')) except OSError: - self.logger.debug("Init script for service %s does not exist" % entry.get('name')) + self.logger.debug("Init script for service %s does not exist" % + entry.get('name')) return False - + if entry.get('status') == 'off': self.cmd.run("/etc/init.d/%s stop" % (entry.get('name'))) - cmdrc = self.cmd.run("/sbin/rc-update del %s default" % (entry.get('name'))) + cmdrc = self.cmd.run("/sbin/rc-update del %s default" % + (entry.get('name'))) else: - cmdrc = self.cmd.run("/sbin/rc-update add %s default" % entry.get('name'))[0] + cmdrc = self.cmd.run("/sbin/rc-update add %s default" % + entry.get('name'))[0] return cmdrc == 0 def FindExtra(self): |