Exemplo n.º 1
0
def main_loop(poller=None, conf=None):
    global shutting_down
    shutting_down = gevent.event.Event()
    gevent.monkey.patch_all(thread=False)

    # define custom signal handlers
    signal.signal(signal.SIGINT, shutdown_handler)
    signal.signal(signal.SIGTERM, shutdown_handler)

    logger.debug('Copying default boot loader images')
    netboot.copy_default_loader_images()

    logger.debug('Clearing old running commands')
    poller.clear_running_commands(u'Stale command cleared on startup')

    logger.debug('Entering main provision loop')
    while True:
        try:
            poller.poll()
        except:
            logger.exception('Failed to poll for queued commands')
        if shutting_down.wait(timeout=conf.get('SLEEP_TIME', 20)):
            gevent.hub.get_hub().join() # let running greenlets terminate
            break
    logger.debug('Exited main provision loop')
Exemplo n.º 2
0
 def test_pxelinux_is_populated(self):
     if not os.path.exists('/usr/share/syslinux'):
         raise SkipTest('syslinux is not installed')
     netboot.copy_default_loader_images()
     pxelinux_path = os.path.join(self.tftp_root, 'pxelinux.0')
     self.assertTrue(os.path.exists(pxelinux_path))
     menuc32_path = os.path.join(self.tftp_root, 'menu.c32')
     self.assertTrue(os.path.exists(menuc32_path))
Exemplo n.º 3
0
 def test_pxelinux_is_populated(self):
     if not os.path.exists('/usr/share/syslinux'):
         raise unittest.SkipTest('syslinux is not installed')
     netboot.copy_default_loader_images()
     pxelinux_path = os.path.join(self.tftp_root, 'pxelinux.0')
     self.assertTrue(os.path.exists(pxelinux_path))
     menuc32_path = os.path.join(self.tftp_root, 'menu.c32')
     self.assertTrue(os.path.exists(menuc32_path))