Ticket #520: debinit.patch

File debinit.patch, 1.2 KB (added by desai, 14 years ago)
  • src/lib/Client/Tools/DebInit.py

     
    1111    __handles__ = [('Service', 'deb')] 
    1212    __req__ = {'Service': ['name', 'status']} 
    1313    __svcrestart__ = 'restart' 
    14     svcre = re.compile("/etc/.*/[SK]\d\d(?P<name>\S+)") 
     14    svcre = re.compile("/etc/.*/[SK]\d+(?P<name>\S+)") 
    1515 
    1616    # implement entry (Verify|Install) ops 
    1717    def VerifyService(self, entry, _): 
    1818        '''Verify Service status for entry''' 
    1919        rawfiles = glob.glob("/etc/rc*.d/*%s" % (entry.get('name'))) 
    20         files = [filename for filename in rawfiles if \ 
    21                  self.svcre.match(filename).group('name') == entry.get('name')] 
     20        files = [] 
     21        for filename in rawfiles: 
     22            match = self.svcre.match(filename) 
     23            if not match: 
     24                self.logger.error("Failed to match file: %s" % filename) 
     25            if match.group('name') == entry.get('name'): 
     26                files.append(filename) 
    2227        if entry.get('status') == 'off': 
    2328            if files: 
    2429                entry.set('current_status', 'on')