[PATCH v2] PEP8 for mockmodel.py
by Adam King
Updated mockmodel.py and makefile.am per Sheldon's comments.
Adam King (1):
PEP8 for mockmodel.py
Makefile.am | 1 +
src/kimchi/mockmodel.py | 69 ++++++++++++++++++++++++++++---------------------
2 files changed, 40 insertions(+), 30 deletions(-)
--
1.8.1.4
10 years, 8 months
[V2 0/2] Fibre Channel SCSI Storage Pool UI
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
V1 - V2: Address comments of Message Id, menu width
Yu Xin Huo (2):
Fibre Channel SCSI Storage Pool UI
Add translation for FC SCSI Storage Pool
po/en_US.po | 6 +++++
po/kimchi.pot | 6 +++++
po/pt_BR.po | 6 +++++
po/zh_CN.po | 6 +++++
ui/css/theme-default/storage.css | 2 +-
ui/js/src/kimchi.api.js | 14 +++++++++++++
ui/js/src/kimchi.storagepool_add_main.js | 31 ++++++++++++++++++++++++++++-
ui/pages/i18n.html.tmpl | 2 +-
ui/pages/storagepool-add.html.tmpl | 12 +++++++++++
9 files changed, 81 insertions(+), 4 deletions(-)
10 years, 9 months
[PATCH] add a method to probe the permission as qemu user
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
now I want to improve the template integrity verification.
I need to check the 'qemu' user can open an iso files.
This patch is used to 'qemu' user has permission to open a file.
Test this patch:
$ mkdir -p a/b/c
$ touch a/b/c/f
$ chmod o-x a/b/c
$ sudo PYTHONPATH=src python -c '
from kimchi.utils import probe_file_permission_as_user
print probe_file_permission_as_user("a/b/c/f", "qemu")'
It will return False
change another user, it may return True
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/utils.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index d4ab1a1..baee936 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -22,8 +22,11 @@
#
import cherrypy
+import grp
+from multiprocessing import Process, Queue
import os
import psutil
+import pwd
import re
import subprocess
import urllib2
@@ -234,3 +237,24 @@ def run_setfacl_set_attr(path, attr="r", user=""):
set_user = ["setfacl", "--modify", "user:%s:%s" % (user, attr), path]
out, error, ret = run_command(set_user)
return ret == 0
+
+
+def probe_file_permission_as_user(file, user):
+ def probe_permission(q, file, user):
+ uid = pwd.getpwnam(user).pw_uid
+ gid = pwd.getpwnam(user).pw_gid
+ gids = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
+ os.setgid(gid)
+ os.setgroups(gids)
+ os.setuid(uid)
+ try:
+ with open(file) as f:
+ q.put(True)
+ except Exception as e:
+ q.put(False)
+
+ queue = Queue()
+ p = Process(target=probe_permission, args=(queue, file, user))
+ p.start()
+ p.join()
+ return queue.get()
--
1.8.4.2
10 years, 9 months
[RFC] UI: Support Selecting SCSI Volume when Creating a VM
by Hongliang Wang
Hi all,
Royce talked this topic with me today that the UI part is missing for
SCSI volume selecting when creating a VM. In the current design, VM is
created through a template and no extra options are available at VM
creation: template defines which pool and disk size, and Kimchi will
create a volume in the pool with specified disk size for the VM. Though
SCSI volumes are read-only and we can't create anything in SCSI pool, we
need allow user to select a volume in SCSI pool. So my initial
suggestion to the VM creation UI looks like:
/// --- Create VM Window --- ///
1. Virtual Machine Name
The name used to identify the virtual machine. If omitted, a name will
be chosen based on the template used.
[ Text box here to enter VM name ]
2. Template
Please choose a template.
[ Templates list here to be selected ]
3. Volumes (this part will be only available when SCSI pool is selected
in Step 2)
[ Volumes list in SCSI pool to be selected ]
/// Create ///
Does this make sense? If so, I'll send out patches for it.
10 years, 9 months
[PATCH 0/3] template integrity verification: verify storagepool
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Sometimes, user create a template, storagepool will change later.
So users can not create a vm from this template successfully.
It is necessary to check storagepool of a template.
By the way storagepool, this verification does not depend on volume ref_cnt
Storagepool delete depends on volume ref_cnt
I make a mistake.
So sorry.
ShaoHe Feng (3):
template integrity verification: verify storagepool, update API.md
template integrity verification: verify storagepool in backend
template integrity verification: update test case to verify
storagepool
docs/API.md | 1 +
src/kimchi/mockmodel.py | 3 +++
src/kimchi/model/templates.py | 5 +++++
src/kimchi/vmtemplate.py | 10 ++++++++++
tests/test_model.py | 9 +++++++++
tests/test_rest.py | 13 +++++++++++++
6 files changed, 41 insertions(+)
--
1.8.4.2
10 years, 9 months
[V1] StoragePool Edit: Add Disk to Logical Pool
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 12 +++++++++
ui/js/src/kimchi.storage_main.js | 38 ++++++++++++++++++++++++++++++
ui/js/src/kimchi.storagepool_add_main.js | 2 +-
ui/pages/i18n.html.tmpl | 1 +
ui/pages/tabs/storage.html.tmpl | 10 ++++++++
5 files changed, 62 insertions(+), 1 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 686141b..ee7f0d8 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -745,5 +745,17 @@ var kimchi = {
kimchi.message.error(data.responseJSON.reason);
}
});
+ },
+
+ updateStoragePool : function(name, content, suc, err) {
+ $.ajax({
+ url : kimchi.url + "storagepools/" + encodeURIComponent(name),
+ type : 'PUT',
+ contentType : 'application/json',
+ dataType : 'json',
+ data : JSON.stringify(content)
+ }).done(suc).fail(err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ });
}
};
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index d65da0b..40aceb7 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -27,6 +27,7 @@ kimchi.doListStoragePools = function() {
value.usage = parseInt(value.allocated / value.capacity * 100) || 0;
value.capacity = kimchi.changetoProperUnit(value.capacity,1);
value.allocated = kimchi.changetoProperUnit(value.allocated,1);
+ value.enableExt = value.type==="logical" ? "" : "hide-content";
if ('kimchi-iso' !== value.type) {
listHtml += kimchi.template(storageHtml, value);
}
@@ -140,6 +141,10 @@ kimchi.storageBindClick = function() {
}
}
});
+ $('.pool-extend').on('click', function() {
+ $("#logicalPoolExtend").dialog("option", "poolName", $(this).data('name'));
+ $("#logicalPoolExtend").dialog("open");
+ });
}
kimchi.doListVolumes = function(poolObj) {
@@ -170,11 +175,44 @@ kimchi.doListVolumes = function(poolObj) {
});
}
+kimchi.initLogicalPoolExtend = function() {
+ $("#logicalPoolExtend").dialog({
+ autoOpen : false,
+ modal : true,
+ width : 600,
+ resizable : false,
+ closeText: "X",
+ open : function(){
+ $(".ui-dialog-titlebar-close", $("#logicalPoolExtend").parent()).removeAttr("title");
+ kimchi.listHostPartitions(function(data) {
+ for(var i=0;i<data.length;i++){
+ if (data[i].type === 'part' || data[i].type === 'disk') {
+ $('.host-partition', '#logicalPoolExtend').append(kimchi.template($('#logicalPoolExtendTmpl').html(), data[i]));
+ }
+ }
+ });
+ },
+ beforeClose : function() { $('.host-partition', '#logicalPoolExtend').empty(); },
+ buttons : [{
+ class: "ui-button-primary",
+ text: i18n.KCHAPI6007M,
+ click: function(){
+ var devicePaths = [];
+ $("input[type='checkbox']:checked", "#logicalPoolExtend").each(function(){
+ devicePaths.push($(this).prop('value'));
+ })
+ kimchi.updateStoragePool($("#logicalPoolExtend").dialog("option", "poolName"),{disks: devicePaths});
+ }
+ }]
+ });
+}
+
kimchi.storage_main = function() {
$('#storage-pool-add').on('click', function() {
kimchi.window.open('storagepool-add.html');
});
kimchi.doListStoragePools();
+ kimchi.initLogicalPoolExtend();
}
kimchi.changeArrow = function(obj) {
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index 43ff31a..beb59ed 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -53,7 +53,7 @@ kimchi.initStorageAddPage = function() {
listHtml += kimchi.template(deviceHtml, value);
}
});
- $('.host-partition').html(listHtml);
+ $('.host-partition', '#form-pool-add').html(listHtml);
}
kimchi.getStorageServers('netfs', function(data) {
var serverContent = [];
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index fe8ed5b..26ac47b 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -62,6 +62,7 @@ var i18n = {
'KCHAPI6004M': "$_("Confirm")",
'KCHAPI6005M': "$_("Create")",
'KCHAPI6006M': "$_("Warning")",
+ 'KCHAPI6007M': "$_("Save")",
'KCHTMPL6001W': "$_("No iso found")",
diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl
index 6930c22..d36c90e 100644
--- a/ui/pages/tabs/storage.html.tmpl
+++ b/ui/pages/tabs/storage.html.tmpl
@@ -44,6 +44,9 @@
</div>
<ul id="storagepoolsList" class="list-storage"></ul>
</div>
+<div id="logicalPoolExtend" title="$_("Device path")">
+ <div class="host-partition"></div>
+</div>
<script id="storageTmpl" type="html/text">
<li id="{name}">
<div class="storage-li in" data-name="{name}" data-stat="{state}">
@@ -78,6 +81,7 @@
<button class="button-big pool-deactivate" data-stat="{state}" data-name="{name}"><span class="text">$_("Deactivate")</span></button>
<button class="button-big pool-activate" data-stat="{state}" data-name="{name}"><span class="text">$_("Activate")</span></button>
<button class="button-big red pool-delete" data-stat="{state}" data-name="{name}"><span class="text">$_("Undefine")</span></button>
+ <button class="button-big pool-extend {enableExt}" data-stat="{state}" data-name="{name}"><span class="text">$_("Extend")</span></button>
</div>
</div>
</div>
@@ -110,6 +114,12 @@
</div>
</div>
</script>
+<script id="logicalPoolExtendTmpl" type="html/text">
+ <div>
+ <input type="checkbox" value="{path}" name="devices">
+ <label for="{name}">{path}</label>
+ </div>
+</script>
<script>
kimchi.storage_main();
</script>
--
1.7.1
10 years, 9 months
[PATCH V2 1/2] Bug Fix #282: Disable Start/Stop network buttons while wait backend lag
by Rodrigo Trujillo
When the user tries to Start/Stop (up/down) a network, there is a lag in
the backend, and it was possible to click on start/stop/delete again,
and again, generating errors. This patch disables the buttons and shows
loading gif to user, avoind this kind of error.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/css/theme-default/network.css | 5 +++++
ui/js/src/kimchi.network.js | 14 ++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ui/css/theme-default/network.css b/ui/css/theme-default/network.css
index 80640a3..67f2aa2 100644
--- a/ui/css/theme-default/network.css
+++ b/ui/css/theme-default/network.css
@@ -132,6 +132,11 @@
margin-left: 29px;
}
+.network .list .nw-loading {
+ background: #c0c0c0 url(../../images/theme-default/loading.gif)
+ center no-repeat;
+}
+
.network .list .up {
background: linear-gradient(to bottom, #BFD255 0%, #8EB92A 50%,
#72AA00 51%, #9ECB2D 100%) repeat scroll 0 0 transparent;
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 91324ee..7cedc01 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -84,20 +84,26 @@ kimchi.addNetworkActions = function(network) {
$(".menu-container", "#" + network.name).toggle(false);
var menu = $(evt.currentTarget).parent();
if ($(evt.currentTarget).attr("nwAct") === "start") {
+ $(".network-state", $("#" + network.name)).switchClass("down", "nw-loading");
+ $("[nwAct='start']", menu).addClass("ui-state-disabled");
+ $("[nwAct='delete']", menu).addClass("ui-state-disabled");
+ $(":first-child", $("[nwAct='delete']", menu)).attr("disabled", true);
kimchi.toggleNetwork(network.name, true, function() {
$("[nwAct='start']", menu).addClass("hide-action-item");
+ $("[nwAct='start']", menu).removeClass("ui-state-disabled");
$("[nwAct='stop']", menu).removeClass("hide-action-item");
- $("[nwAct='delete']", menu).addClass("ui-state-disabled");
- $(":first-child", $("[nwAct='delete']", menu)).attr("disabled", true);
- $(".network-state", $("#" + network.name)).switchClass("down", "up");
+ $(".network-state", $("#" + network.name)).switchClass("nw-loading", "up");
});
} else if ($(evt.currentTarget).attr("nwAct") === "stop") {
+ $(".network-state", $("#" + network.name)).switchClass("up", "nw-loading");
+ $("[nwAct='stop']", menu).addClass("ui-state-disabled");
kimchi.toggleNetwork(network.name, false, function() {
$("[nwAct='start']", menu).removeClass("hide-action-item");
$("[nwAct='stop']", menu).addClass("hide-action-item");
+ $("[nwAct='stop']", menu).removeClass("ui-state-disabled");
$("[nwAct='delete']", menu).removeClass("ui-state-disabled");
$(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled");
- $(".network-state", $("#" + network.name)).switchClass("up", "down");
+ $(".network-state", $("#" + network.name)).switchClass("nw-loading", "down");
});
} else if ($(evt.currentTarget).attr("nwAct") === "delete") {
kimchi.confirm({
--
1.8.5.3
10 years, 9 months
[PATCHv3 0/3]Fix validation on readonly pool type
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Some pool types (scsi, iscsi, mpath) do not allow create/delete
storage volume, so it is wrong to delete these volumes when vm delete.
Fix it by just delete non read only pool types.
Royce Lv (3):
Fix vm creation storage rollback clean
Prevent volume create and delete for certain pool types
Clear pep8 failure in make check
src/kimchi/config.py.in | 3 +++
src/kimchi/control/base.py | 2 ++
src/kimchi/i18n.py | 1 +
src/kimchi/isoinfo.py | 4 ++--
src/kimchi/model/storageservers.py | 4 ++--
src/kimchi/model/storagevolumes.py | 18 +++++++++++++++---
src/kimchi/model/vms.py | 16 +++++++++++-----
tests/test_model.py | 6 +++---
8 files changed, 39 insertions(+), 15 deletions(-)
--
1.8.1.2
10 years, 9 months
[PATCH v2 0/5] Add users and groups to VMs
by Crístian Viana
Here are the differences between the previous patchset (v1) and this one:
- New patch "Use proper term "user name" instead of "user id"" has been added.
- Patch "Return users and groups when fetching VM info" has been updated to log
the exception message when there is an invalid metadata value in a VM. Notice
that an invalid metadata value can only be written to the VM XML by external
access; users from within Kimchi will always store correct value through
the app.
- Rebased to 5d82241.
Crístian Viana (5):
Override only the updated "User" methods in "patch_auth"
Use proper term "user name" instead of "user id"
Add functions to check if a user/group exists
Return users and groups when fetching VM info
Add/remove users and groups to VMs
docs/API.md | 6 ++++
po/en_US.po | 2 +-
po/kimchi.pot | 2 +-
po/pt_BR.po | 2 +-
po/zh_CN.po | 2 +-
src/kimchi/API.json | 22 ++++++++++++++
src/kimchi/auth.py | 60 ++++++++++++++++++++++++++------------
src/kimchi/control/vms.py | 6 ++--
src/kimchi/i18n.py | 8 +++++-
src/kimchi/mockmodel.py | 4 ++-
src/kimchi/model/vms.py | 62 ++++++++++++++++++++++++++++++++++++----
src/kimchi/root.py | 4 +--
tests/test_authorization.py | 19 ++++++++++++
tests/test_mockmodel.py | 2 +-
tests/test_model.py | 44 +++++++++++++++++++++++++++-
tests/test_rest.py | 10 ++++---
tests/utils.py | 26 +++++------------
ui/js/src/kimchi.login_window.js | 16 +++++------
ui/js/src/kimchi.user.js | 14 ++++-----
ui/pages/login-window.html.tmpl | 4 +--
20 files changed, 239 insertions(+), 76 deletions(-)
--
1.8.5.3
10 years, 9 months
[PATCH 1/2] Add static directory configurations for plugin's ui
by Mark Wu
Plugin needs static directory configuration for ui requirements,
such as css, js, etc, as what we do for kimchi base. So this
patch refactors the server configuration to make plugin can share
the same code with kimchi. To avoid the warning messages reported from
cherrypy's path checker, it also adds empty ui directory for the
sample plugin, which also can demonstrate plugin's ui directory
sturcture. We can add actual ui files under those direcotries later.
---
plugins/sample/ui/css/.gitignore | 0
plugins/sample/ui/images/.gitignore | 0
plugins/sample/ui/js/.gitignore | 0
plugins/sample/ui/libs/.gitignore | 0
src/kimchi/config.py.in | 79 +++++++++++++++++++++++++++++++++++++
src/kimchi/server.py | 77 ++----------------------------------
6 files changed, 82 insertions(+), 74 deletions(-)
create mode 100644 plugins/sample/ui/css/.gitignore
create mode 100644 plugins/sample/ui/images/.gitignore
create mode 100644 plugins/sample/ui/js/.gitignore
create mode 100644 plugins/sample/ui/libs/.gitignore
diff --git a/plugins/sample/ui/css/.gitignore b/plugins/sample/ui/css/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/plugins/sample/ui/images/.gitignore b/plugins/sample/ui/images/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/plugins/sample/ui/js/.gitignore b/plugins/sample/ui/js/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/plugins/sample/ui/libs/.gitignore b/plugins/sample/ui/libs/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index 2747164..f599c4d 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -127,6 +127,85 @@ class PluginPaths(Paths):
self.conf_file = os.path.join(self.conf_dir, '%s.conf' % name)
+class AppConfig(dict):
+
+ # expires is one year.
+ CACHEEXPIRES = 31536000
+
+ def _get_ui_configs(self, paths):
+ ui_configs = {}
+ for sub_dir in ('css', 'js', 'libs', 'images'):
+ ui_configs['/' + sub_dir] = {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': os.path.join(paths.ui_dir, sub_dir),
+ 'tools.nocache.on': False}
+ if sub_dir != 'images':
+ ui_configs['/' + sub_dir].update({
+ 'tools.expires.on': True,
+ 'tools.expires.secs': AppConfig.CACHEEXPIRES})
+ return ui_configs
+
+
+class KimchiConfig(AppConfig):
+ kimchi_config = {
+ '/': {'tools.trailing_slash.on': False,
+ 'request.methods_with_bodies': ('POST', 'PUT'),
+ 'tools.nocache.on': True,
+ 'tools.sessions.on': True,
+ 'tools.sessions.name': 'kimchi',
+ 'tools.sessions.httponly': True,
+ 'tools.sessions.locking': 'explicit',
+ 'tools.sessions.storage_type': 'ram',
+ 'tools.kimchiauth.on': False},
+ '/data/screenshots': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': get_screenshot_path(),
+ 'tools.nocache.on': False
+ },
+ '/data/debugreports': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': get_debugreports_path(),
+ 'tools.nocache.on': False,
+ 'tools.kimchiauth.on': True,
+ 'tools.staticdir.content_types': {'xz': 'application/x-xz'}
+ },
+ '/config/ui/tabs.xml': {
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename': '%s/config/ui/tabs.xml' %
+ paths.prefix,
+ 'tools.nocache.on': True
+ },
+ '/favicon.ico': {
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename': '%s/images/logo.ico' % paths.ui_dir
+ },
+ '/help': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '%s/ui/pages/help' % paths.prefix,
+ 'tools.nocache.on': False
+ }
+ }
+
+ def __init__(self):
+ super(KimchiConfig, self).__init__(self)
+ self.update(self.kimchi_config)
+ self.update(self._get_ui_configs(paths))
+
+
+class PluginConfig(AppConfig):
+ def __init__(self, plugin_name):
+ super(PluginConfig, self).__init__(self)
+ plugin_config = {
+ '/ui/config/tab-ext.xml': {
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ os.path.join(PluginPaths(plugin_name).ui_dir,
+ 'config/tab-ext.xml'),
+ 'tools.nocache.on': True}}
+ self.update(plugin_config)
+ self.update(self._get_ui_configs(PluginPaths(plugin_name)))
+
+
def _get_config():
config = SafeConfigParser()
config.add_section("server")
diff --git a/src/kimchi/server.py b/src/kimchi/server.py
index 5475b92..0d02868 100644
--- a/src/kimchi/server.py
+++ b/src/kimchi/server.py
@@ -29,7 +29,7 @@ from kimchi import config
from kimchi.model import model
from kimchi import mockmodel
from kimchi import vnc
-from kimchi.config import paths, PluginPaths
+from kimchi.config import paths, KimchiConfig, PluginConfig
from kimchi.control import sub_nodes
from kimchi.root import KimchiRoot
from kimchi.utils import get_enabled_plugins, import_class
@@ -57,73 +57,6 @@ def set_no_cache():
class Server(object):
- # expires is one year.
- CACHEEXPIRES = 31536000
- configObj = {
- '/': {'tools.trailing_slash.on': False,
- 'request.methods_with_bodies': ('POST', 'PUT'),
- 'tools.nocache.on': True,
- 'tools.sessions.on': True,
- 'tools.sessions.name': 'kimchi',
- 'tools.sessions.httponly': True,
- 'tools.sessions.locking': 'explicit',
- 'tools.sessions.storage_type': 'ram',
- 'tools.kimchiauth.on': False},
- '/css': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/css' % paths.prefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False
- },
- '/js': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/js' % paths.prefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False
- },
- '/libs': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/libs' % paths.prefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- },
- '/images': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/images' % paths.prefix,
- 'tools.nocache.on': False
- },
- '/data/screenshots': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': config.get_screenshot_path(),
- 'tools.nocache.on': False
- },
- '/data/debugreports': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': config.get_debugreports_path(),
- 'tools.nocache.on': False,
- 'tools.kimchiauth.on': True,
- 'tools.staticdir.content_types': {'xz': 'application/x-xz'}
- },
- '/config/ui/tabs.xml': {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename': '%s/config/ui/tabs.xml' %
- paths.prefix,
- 'tools.nocache.on': True
- },
- '/favicon.ico': {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename': '%s/images/logo.ico' % paths.ui_dir
- },
- '/help': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/pages/help' % paths.prefix,
- 'tools.nocache.on': False
- }
- }
-
def __init__(self, options):
make_dirs = [
os.path.dirname(os.path.abspath(options.access_log)),
@@ -137,6 +70,7 @@ class Server(object):
if not os.path.isdir(directory):
os.makedirs(directory)
+ self.configObj = KimchiConfig()
cherrypy.tools.nocache = cherrypy.Tool('on_end_resource', set_no_cache)
cherrypy.tools.kimchiauth = cherrypy.Tool('before_handler',
auth.kimchiauth)
@@ -214,12 +148,7 @@ class Server(object):
script_name = plugin_config['kimchi']['uri']
del plugin_config['kimchi']
- plugin_config['/ui/config/tab-ext.xml'] = {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename':
- os.path.join(PluginPaths(plugin_name).ui_dir,
- 'config/tab-ext.xml'),
- 'tools.nocache.on': True}
+ plugin_config.update(PluginConfig(plugin_name))
except KeyError:
continue
--
1.8.4.2
10 years, 9 months