예제 #1
0
    def test_target(self,id):
        try:
            i = int(id)
        except ValueError:
            print '%s is not a valid id' % id
            return
        targetmodel = TargetModel(self.logger,self.config)
        target = targetmodel.get(i)
        if target == None:
            print('id: %d does not exist' % i)
            return

        puncher = Puncher(self.logger,targetmodel,None)
        puncher.punch_it_now(target)
예제 #2
0
    def test_target(self, id):
        try:
            i = int(id)
        except ValueError:
            print '%s is not a valid id' % id
            return
        targetmodel = TargetModel(self.logger, self.config)
        target = targetmodel.get(i)
        if target == None:
            print('id: %d does not exist' % i)
            return

        puncher = Puncher(self.logger, targetmodel, None)
        puncher.punch_it_now(target)
예제 #3
0
 def run(self):
     print 'starting %s ....' % PROGNAME
     logger.info('starting %s ....' % PROGNAME)
     config = SkyPunchConfig(logger)	
     targetmodel = TargetModel(logger,config)
     notifiermodel = NotifierModel(logger,config)
     puncher = Puncher(logger,targetmodel,notifiermodel)
     try:
         while True:
             ids = targetmodel.get_ids()
             for id in ids:
                 target = targetmodel.get(id)
                 if target.enabled:
                     puncher.punch(target)
             time.sleep(config.getint(skypunchconfig.SETTINGS,skypunchconfig.MAINLOOPTOV))
     except SystemExit, e:
         sys.exit(e)
예제 #4
0
 def run(self):
     print 'starting %s ....' % PROGNAME
     logger.info('starting %s ....' % PROGNAME)
     config = SkyPunchConfig(logger)
     targetmodel = TargetModel(logger, config)
     notifiermodel = NotifierModel(logger, config)
     puncher = Puncher(logger, targetmodel, notifiermodel)
     try:
         while True:
             ids = targetmodel.get_ids()
             for id in ids:
                 target = targetmodel.get(id)
                 if target.enabled:
                     puncher.punch(target)
             time.sleep(
                 config.getint(skypunchconfig.SETTINGS,
                               skypunchconfig.MAINLOOPTOV))
     except SystemExit, e:
         sys.exit(e)