Пример #1
0
    def start_wb(self, wb):
        """ Start the webbox with the definition 'wb'. """
        wb['status'] = "running"

        path = "webbox"

        # load configuration into 'config' variable
        webbox_config = wb['location'] + os.sep + "webbox.json"
        logging.debug("Loading configuration from: %s" % webbox_config)
        conf_fh = open(webbox_config, "r")
        config = json.loads(conf_fh.read())
        conf_fh.close()

        port = ":" + str(self.config['management']['port'])

        # dont put the port in the webbox URL if it is 443 and SSL or if it is 80 and clear
        if self.config['url_scheme'] == "https" and port == ":443":
            port = ""
        elif self.config['url_scheme'] == "http" and port == ":80":
            port = ""

        config['webbox']['url'] = self.config['url_scheme'] + "://" + self.config['management']['host'] + port + "/" + wb['directory'] + "/" + path
        config['webbox']['webbox_dir'] = wb['location']
        config['webbox']['4store']['delay'] = 2 # force a delay

        webbox = WebBox(config['webbox'])
        resource = webbox.get_resource()

        self.root.putChild(wb['directory'], resource)
        self.webboxes[ wb['directory'] ] = webbox
Пример #2
0
    def start_vhost(self, vhost):
        """ Start the vhost with the definition 'vhost'. """
        vhost['status'] = "running"

        path = "webbox"

        webbox = WebBox(vhost['config'])
        resource = webbox.get_resource()

        self.vhost.addHost(vhost['host'], resource)
        self.webboxes[ vhost['host'] ] = webbox