def test_file_with_def_noport (self): testfile = open("testfile", "w") print >> testfile, "[components]" print >> testfile, "component=https://localhost" testfile.close() component = Component() location = find_intended_location(component, config_files=["testfile"]) assert location == ("", 0)
def test_file_without_def (self): testfile = open("testfile", "w") print >> testfile, "[components]" print >> testfile, "someothercomponent=https://localhost:8080" testfile.close() component = Component() location = find_intended_location(component, config_files=["testfile"]) assert location == ("", 0)
def test_file_with_bad_def (self): testfile = open("testfile", "w") print >> testfile, "[components]" print >> testfile, "component=notaurl" testfile.close() component = Component() location = find_intended_location(component, config_files=["testfile"]) assert location == ("", 0)
def test_nofile (self): component = Component() location = find_intended_location(component, config_files=["testfile"]) assert location == ("", 0)
pidfile.close() if state_name: state_file_name = "%s/%s" % (state_file_location(), state_name) try: component = cPickle.load(open(state_file_name)) except: component = component_cls(**cls_kwargs) component.logger.error("unable to load state from %s", state_file_name, exc_info=True) component.statefile = state_file_name else: component = component_cls(**cls_kwargs) location = find_intended_location(component) try: cp = ConfigParser.ConfigParser() cp.read([Cobalt.CONFIG_FILES[0]]) keypath = os.path.expandvars(cp.get('communication', 'key')) except: keypath = '/etc/cobalt.key' if single_threaded: server = BaseXMLRPCServer(location, keyfile=keypath, certfile=keypath, register=register, timeout=time_out) else: server = XMLRPCServer(location,
pidfile.close() if state_name: state_file_name = "%s/%s" % (state_file_location(), state_name) try: component = cPickle.load(open(state_file_name)) except: component = component_cls(**cls_kwargs) component.logger.error( "UNABLE TO LOAD STATE FROM %s. STARTING WITH A BLANK SLATE.", state_file_name, exc_info=True ) component.statefile = state_file_name else: component = component_cls(**cls_kwargs) location = find_intended_location(component) try: keypath = os.path.expandvars(get_config_option("communication", "key")) certpath = os.path.expandvars(get_config_option("communication", "cert")) capath = os.path.expandvars(get_config_option("communication", "ca")) except: keypath = "/etc/cobalt.key" certpath = None capath = None if single_threaded: server = BaseXMLRPCServer( location, keyfile=keypath, certfile=certpath, cafile=capath, register=register, timeout=time_out ) else: server = XMLRPCServer(