Ticket #846: bcfg2-chkconfig.patch

File bcfg2-chkconfig.patch, 1.3 KB (added by somekool <[email protected]…>, 13 years ago)

patched!

  • src/lib/Client/Tools/Chkconfig.py

     
    4141 
    4242        if entry.get('status') == 'on': 
    4343            status = (len(onlevels) > 0 ) 
     44            command = 'start' 
    4445        else: 
    4546            status = (len(onlevels) == 0) 
     47            command = 'stop' 
    4648 
    4749        if entry.get('supervised', 'false') == 'true': 
    48             pstatus, pout = self.cmd.run('/sbin/service %s status' % \ 
    49                                          entry.get('name')) 
    50             if pstatus: 
    51                 self.cmd.run('/sbin/service %s start' % (entry.get('name'))) 
    52             pstatus, pout = self.cmd.run('/sbin/service %s status' % \ 
    53                                          entry.get('name')) 
     50            pstatus, pout = self.cmd.run('/sbin/service %s status' % entry.get('name')) 
     51            if not(self.setup.get('dryrun')) and ((command == 'start' and pstatus) or (command == 'stop' and not pstatus)): 
     52                self.cmd.run('/sbin/service %s %s' % (entry.get('name'), command)) 
     53                pstatus, pout = self.cmd.run('/sbin/service %s status' % entry.get('name')) 
     54 
    5455            # chkconfig/init.d service 
    5556            if entry.get('status') == 'on': 
    5657                status = status and not pstatus