Beispiel #1
0
    def __init__(self, wok_options):
        if hasattr(wok_options, "model"):
            self.model = wok_options.model
        elif wok_options.test:
            self.model = mockmodel.MockModel()
        else:
            self.model = kimchiModel.Model()

        dev_env = wok_options.environment != 'production'
        super(KimchiRoot, self).__init__(self.model, dev_env)

        for ident, node in sub_nodes.items():
            setattr(self, ident, node(self.model))

        if isinstance(self.model, kimchiModel.Model):
            vnc_ws_proxy = vnc.new_ws_proxy()
            cherrypy.engine.subscribe('exit', vnc_ws_proxy.terminate)

        self.api_schema = json.load(open(os.path.join(os.path.dirname(
                                    os.path.abspath(__file__)), 'API.json')))
        self.paths = config.kimchiPaths
        self.domain = 'kimchi'
        self.messages = messages

        make_dirs = [
            os.path.dirname(os.path.abspath(config.get_object_store())),
            os.path.abspath(config.get_distros_store()),
            os.path.abspath(config.get_screenshot_path())
        ]
        for directory in make_dirs:
            if not os.path.isdir(directory):
                os.makedirs(directory)
Beispiel #2
0
    def __init__(self, wok_options):
        make_dirs = [
            os.path.dirname(os.path.abspath(config.get_object_store())),
            os.path.abspath(config.get_distros_store()),
            os.path.abspath(config.get_screenshot_path()),
            os.path.abspath(config.get_virtviewerfiles_path())
        ]
        for directory in make_dirs:
            if not os.path.isdir(directory):
                os.makedirs(directory)

        # When running on test mode, specify the objectstore location to
        # remove the file on server shutting down. That way, the system will
        # not suffer any change while running on test mode
        if wok_options.test and (wok_options.test is True
                                 or wok_options.test.lower() == 'true'):
            self.objectstore_loc = tempfile.mktemp()
            self.model = mockmodel.MockModel(self.objectstore_loc)

            def remove_objectstore():
                if os.path.exists(self.objectstore_loc):
                    os.unlink(self.objectstore_loc)

            cherrypy.engine.subscribe('exit', remove_objectstore)
        else:
            self.model = kimchiModel.Model()

        dev_env = wok_options.environment != 'production'
        super(Kimchi, self).__init__(self.model, dev_env)

        for ident, node in sub_nodes.items():
            setattr(self, ident, node(self.model))

        self.api_schema = json.load(
            open(
                os.path.join(os.path.dirname(os.path.abspath(__file__)),
                             'API.json')))
        self.paths = config.kimchiPaths
        self.domain = 'kimchi'
        self.messages = messages

        self.extends = {
            "/plugins/gingerbase": {
                "host-dashboard.html": "/plugins/kimchi/js/kimchi.peers.js"
            }
        }

        self.depends = ['gingerbase']

        # Some paths or URI's present in the objectstore have changed after
        # Kimchi 2.0.0 release. Check here if an upgrade in the schema and data
        # are necessary.
        if upgrade_objectstore_schema(config.get_object_store(), 'version'):
            upgrade_objectstore_data('icon', 'images', 'plugins/kimchi/')
            upgrade_objectstore_data('storagepool', '/storagepools',
                                     '/plugins/kimchi')
            upgrade_objectstore_template_disks(self.model.conn)

        # Upgrade memory data, if necessary
        upgrade_objectstore_memory()
Beispiel #3
0
    def __init__(self, wok_options):
        if hasattr(wok_options, "model"):
            self.model = wok_options.model
        elif wok_options.test:
            self.model = mockmodel.MockModel()
        else:
            self.model = kimchiModel.Model()

        dev_env = wok_options.environment != 'production'
        super(KimchiRoot, self).__init__(self.model, dev_env)

        for ident, node in sub_nodes.items():
            setattr(self, ident, node(self.model))

        if isinstance(self.model, kimchiModel.Model):
            vnc_ws_proxy = vnc.new_ws_proxy()
            cherrypy.engine.subscribe('exit', vnc_ws_proxy.terminate)

        self.api_schema = json.load(
            open(
                os.path.join(os.path.dirname(os.path.abspath(__file__)),
                             'API.json')))
        self.paths = config.kimchiPaths
        self.domain = 'kimchi'
        self.messages = messages

        make_dirs = [
            os.path.dirname(os.path.abspath(config.get_object_store())),
            os.path.abspath(config.get_distros_store()),
            os.path.abspath(config.get_debugreports_path()),
            os.path.abspath(config.get_screenshot_path())
        ]
        for directory in make_dirs:
            if not os.path.isdir(directory):
                os.makedirs(directory)
Beispiel #4
0
    def __init__(self, wok_options):
        make_dirs = [
            os.path.dirname(os.path.abspath(config.get_object_store())),
            os.path.abspath(config.get_distros_store()),
            os.path.abspath(config.get_screenshot_path()),
            os.path.abspath(config.get_virtviewerfiles_path()),
        ]
        for directory in make_dirs:
            if not os.path.isdir(directory):
                os.makedirs(directory)

        # When running on test mode, specify the objectstore location to
        # remove the file on server shutting down. That way, the system will
        # not suffer any change while running on test mode
        if wok_options.test and (
            wok_options.test is True or wok_options.test.lower() == 'true'
        ):
            self.objectstore_loc = tempfile.mktemp()
            self.model = mockmodel.MockModel(self.objectstore_loc)

            def remove_objectstore():
                if os.path.exists(self.objectstore_loc):
                    os.unlink(self.objectstore_loc)

            cherrypy.engine.subscribe('exit', remove_objectstore)
        else:
            self.model = kimchiModel.Model()

        dev_env = wok_options.environment != 'production'
        super(Kimchi, self).__init__(self.model, dev_env)

        for ident, node in sub_nodes.items():
            setattr(self, ident, node(self.model))

        with open(
            os.path.join(os.path.dirname(
                os.path.abspath(__file__)), 'API.json')
        ) as fd:
            self.api_schema = json.load(fd)

        self.paths = config.kimchiPaths
        self.domain = 'kimchi'
        self.messages = messages

        # Some paths or URI's present in the objectstore have changed after
        # Kimchi 2.0.0 release. Check here if an upgrade in the schema and data
        # are necessary.
        if upgrade_objectstore_schema(config.get_object_store(), 'version'):
            upgrade_objectstore_data('icon', 'images', 'plugins/kimchi/')
            upgrade_objectstore_data(
                'storagepool', '/storagepools', '/plugins/kimchi')
            upgrade_objectstore_template_disks(self.model.conn)

        # Upgrade memory data, if necessary
        upgrade_objectstore_memory()
Beispiel #5
0
    def __init__(self, wok_options):
        make_dirs = [
            os.path.dirname(os.path.abspath(config.get_object_store())),
            os.path.abspath(config.get_distros_store()),
            os.path.abspath(config.get_screenshot_path()),
            os.path.abspath(config.get_virtviewerfiles_path())
        ]
        for directory in make_dirs:
            if not os.path.isdir(directory):
                os.makedirs(directory)

        if hasattr(wok_options, "model"):
            self.model = wok_options.model
        elif wok_options.test:
            self.model = mockmodel.MockModel()
        else:
            self.model = kimchiModel.Model()

        dev_env = wok_options.environment != 'production'
        super(Kimchi, self).__init__(self.model, dev_env)

        for ident, node in sub_nodes.items():
            setattr(self, ident, node(self.model))

        if isinstance(self.model, kimchiModel.Model):
            ws_proxy = websocket.new_ws_proxy()
            cherrypy.engine.subscribe('exit', ws_proxy.terminate)

        self.api_schema = json.load(
            open(
                os.path.join(os.path.dirname(os.path.abspath(__file__)),
                             'API.json')))
        self.paths = config.kimchiPaths
        self.domain = 'kimchi'
        self.messages = messages

        self.extends = {
            "/plugins/gingerbase": {
                "host-dashboard.html": "/plugins/kimchi/js/kimchi.peers.js"
            }
        }

        # Some paths or URI's present in the objectstore have changed after
        # Kimchi 2.0.0 release. Check here if an upgrade in the schema and data
        # are necessary.
        if upgrade_objectstore_schema(config.get_object_store(), 'version'):
            upgrade_objectstore_data('icon', 'images', 'plugins/kimchi/')
            upgrade_objectstore_data('storagepool', '/storagepools',
                                     '/plugins/kimchi')
            upgrade_objectstore_template_disks(self.model.conn)

        # Upgrade memory data, if necessary
        upgrade_objectstore_memory()
Beispiel #6
0
    def __init__(self, wok_options):
        make_dirs = [
            os.path.dirname(os.path.abspath(config.get_object_store())),
            os.path.abspath(config.get_distros_store()),
            os.path.abspath(config.get_screenshot_path()),
            os.path.abspath(config.get_virtviewerfiles_path())
        ]
        for directory in make_dirs:
            if not os.path.isdir(directory):
                os.makedirs(directory)

        if hasattr(wok_options, "model"):
            self.model = wok_options.model
        elif wok_options.test:
            self.model = mockmodel.MockModel()
        else:
            self.model = kimchiModel.Model()

        dev_env = wok_options.environment != 'production'
        super(Kimchi, self).__init__(self.model, dev_env)

        for ident, node in sub_nodes.items():
            setattr(self, ident, node(self.model))

        if isinstance(self.model, kimchiModel.Model):
            ws_proxy = websocket.new_ws_proxy()
            cherrypy.engine.subscribe('exit', ws_proxy.terminate)

        self.api_schema = json.load(open(os.path.join(os.path.dirname(
                                    os.path.abspath(__file__)), 'API.json')))
        self.paths = config.kimchiPaths
        self.domain = 'kimchi'
        self.messages = messages

        self.extends = {
            "/plugins/gingerbase": {
                "host-dashboard.html": "/plugins/kimchi/js/kimchi.peers.js"
            }
        }

        # Some paths or URI's present in the objectstore have changed after
        # Kimchi 2.0.0 release. Check here if an upgrade in the schema and data
        # are necessary.
        if upgrade_objectstore_schema(config.get_object_store(), 'version'):
            upgrade_objectstore_data('icon', 'images', 'plugins/kimchi/')
            upgrade_objectstore_data('storagepool', '/storagepools',
                                     '/plugins/kimchi')
            upgrade_objectstore_template_disks(self.model.conn)

        # Upgrade memory data, if necessary
        upgrade_objectstore_memory()
Beispiel #7
0
 def __init__(self, location=None):
     self.location = location or config.get_distros_store()
Beispiel #8
0
 def __init__(self, location=None):
     self.location = location or config.get_distros_store()