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)
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)
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)
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)