예제 #1
0
 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)
예제 #2
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)
예제 #3
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)
예제 #4
0
파일: TestServer.py 프로젝트: zzhou/Qsim
 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)
예제 #5
0
파일: TestServer.py 프로젝트: zzhou/Qsim
 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)
예제 #6
0
파일: TestServer.py 프로젝트: zzhou/Qsim
 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)
예제 #7
0
 def test_nofile (self):
     component = Component()
     location = find_intended_location(component, config_files=["testfile"])
     assert location == ("", 0)
예제 #8
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,
예제 #9
0
파일: base.py 프로젝트: ido/cobalt
        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(
예제 #10
0
파일: TestServer.py 프로젝트: zzhou/Qsim
 def test_nofile (self):
     component = Component()
     location = find_intended_location(component, config_files=["testfile"])
     assert location == ("", 0)