Ejemplo n.º 1
0
    def test_system_service(self):

        status = es2system.loop_system(dry_run=False)
        self.assertEquals(status, 0)
Ejemplo n.º 2
0
    def test_system_loop(self):

        # Should get here the role of my machine ...
        status = es2system.loop_system(dry_run=True)
Ejemplo n.º 3
0
service = False

# service is always False because this module is used by the windows version or for testing
# ToDo: The code under the if statement can be deleted, service_system.py is now used by non windows versions
if service:
    # Make sure the pid dir exists
    if not os.path.isdir(es_constants.pid_file_dir):
        try:
            os.makedirs(es_constants.pid_file_dir)
        except os.error:
            logger.error("Cannot create pid directory")

    # Define pid file and create daemon
    pid_file = es_constants.system_pid_filename
    daemon = es2system.SystemDaemon(pid_file, dry_run=dry_run)

    if do_start:
        if daemon.status():
            logger.info('System process is running: Exit')
        else:
            logger.info('System process is NOT running: Start it.')
            daemon.start()
    else:
        if not daemon.status():
            logger.info('System process is NOT running: Exit')
        else:
            logger.info('System process is running: Stop it.')
            daemon.stop()
else:
    es2system.loop_system(dry_run=dry_run)
Ejemplo n.º 4
0
    def test_system_loop(self):

        # Call the system loop in dry mode (exits after first iteration)
        status = es2system.loop_system(dry_run=True)
        self.assertEqual(status, 0)
Ejemplo n.º 5
0
    def test_system_service(self):

        status = es2system.loop_system(dry_run=False)
        self.assertEquals(status, 0)