if not os.path.exists(config_file): error_message = "No such file: %s" % (config_file) else: log_level = 'warning' if options.verbose: log_level = 'info' if options.debug: log_level = 'debug' if options.kill: def _killed_cb(result): #TODO: show a dialog to the user if --graphical is given. if reactor.running: reactor.stop() master.start_stdout_logging( log_level=log_level) #FIXME: should be able to log to file too identifier = master.gen_id_from_config_file_name(config_file) master.log.info( "Will check if lunch master %s is running and kill it if so." % (identifier)) deferred = master.kill_master_if_running(identifier=identifier, directory=logging_dir) deferred.addCallback(_killed_cb) reactor.run() sys.exit(0) try: #print("DEBUG: using config_file %s" % (config_file)) lunch_master = master.run_master(config_file, log_to_file=file_logging_enabled, log_dir=logging_dir, log_level=log_level)
if not os.path.exists(config_file): error_message = "No such file: %s" % (config_file) else: log_level = "warning" if options.verbose: log_level = "info" if options.debug: log_level = "debug" if options.kill: def _killed_cb(result): # TODO: show a dialog to the user if --graphical is given. if reactor.running: reactor.stop() master.start_stdout_logging(log_level=log_level) # FIXME: should be able to log to file too identifier = master.gen_id_from_config_file_name(config_file) master.log.info("Will check if lunch master %s is running and kill it if so." % (identifier)) deferred = master.kill_master_if_running(identifier=identifier, directory=logging_dir) deferred.addCallback(_killed_cb) reactor.run() sys.exit(0) try: # print("DEBUG: using config_file %s" % (config_file)) lunch_master = master.run_master( config_file, log_to_file=file_logging_enabled, log_dir=logging_dir, log_level=log_level ) except master.FileNotFoundError, e: # print("Error starting lunch as master.") msg = "A configuration file is missing. Try the --help flag. " msg += str(e)
""" Tests for lunch Master """ from twisted.trial import unittest from twisted.internet import defer from twisted.python import failure from twisted.internet import reactor from lunch import master from lunch import commands from lunch.states import * LOG_LEVEL = "warning" #LOG_LEVEL = "info" #LOG_LEVEL = "debug" master.start_stdout_logging(LOG_LEVEL) from lunch import logger log = logger.start(name="test") #TODO: add the path to lunch-slave to $PATH class Test_Master(unittest.TestCase): timeout = 4.0 # so that we don't wait in case of a problem def test_read_config(self): pass test_read_config.skip = "TODO." def test_add_remove_command(self): COMMAND_IDENTIFER = "test" COMMAND_LINE = "man man" _deferred = defer.Deferred()
""" Tests for lunch Master """ from twisted.trial import unittest from twisted.internet import defer from twisted.python import failure from twisted.internet import reactor from lunch import master from lunch import commands from lunch.states import * LOG_LEVEL = "warning" #LOG_LEVEL = "info" #LOG_LEVEL = "debug" master.start_stdout_logging(LOG_LEVEL) from lunch import logger log = logger.start(name="test") #TODO: add the path to lunch-slave to $PATH class Test_Master(unittest.TestCase): timeout = 4.0 # so that we don't wait in case of a problem def test_read_config(self): pass test_read_config.skip = "TODO."