[Kimchi-devel] [PATCH 1/1] Moving host tab functionality to gingerbase.
chandra at linux.vnet.ibm.com
chandra at linux.vnet.ibm.com
Mon Aug 31 09:47:14 UTC 2015
From: Chandra Shekhar Reddy Potula <chandra at linux.vnet.ibm.com>
Signed-off-by: Chandra Shekhar Reddy Potula <chandra at linux.vnet.ibm.com>
---
plugins/gingerbase/control/debugreports.py | 61 ++
plugins/gingerbase/disks.py | 196 +++++
plugins/gingerbase/model/debugreports.py | 213 +++++
plugins/gingerbase/repositories.py | 529 +++++++++++++
plugins/gingerbase/swupdate.py | 263 +++++++
plugins/gingerbase/tests/test_host.py | 200 +++++
plugins/gingerbase/ui/css/theme-default/host.css | 287 +++++++
.../gingerbase/ui/css/theme-default/report-add.css | 37 +
.../ui/css/theme-default/report-rename.css | 39 +
.../ui/css/theme-default/repository-add.css | 42 +
.../ui/css/theme-default/repository-edit.css | 88 +++
plugins/gingerbase/ui/js/src/gingerbase.host.js | 858 +++++++++++++++++++++
.../ui/js/src/gingerbase.report_add_main.js | 72 ++
.../ui/js/src/gingerbase.report_rename_main.js | 66 ++
.../ui/js/src/gingerbase.repository_add_main.js | 96 +++
.../ui/js/src/gingerbase.repository_edit_main.js | 74 ++
plugins/gingerbase/ui/pages/help/de_DE/host.dita | 49 ++
plugins/gingerbase/ui/pages/help/en_US/host.dita | 70 ++
plugins/gingerbase/ui/pages/help/es_ES/host.dita | 49 ++
plugins/gingerbase/ui/pages/help/fr_FR/host.dita | 68 ++
plugins/gingerbase/ui/pages/help/it_IT/host.dita | 51 ++
plugins/gingerbase/ui/pages/help/ja_JP/host.dita | 70 ++
plugins/gingerbase/ui/pages/help/ko_KR/host.dita | 47 ++
plugins/gingerbase/ui/pages/help/pt_BR/host.dita | 74 ++
plugins/gingerbase/ui/pages/help/ru_RU/host.dita | 48 ++
plugins/gingerbase/ui/pages/help/zh_CN/host.dita | 45 ++
plugins/gingerbase/ui/pages/help/zh_TW/host.dita | 50 ++
plugins/gingerbase/ui/pages/host.html.tmpl | 177 +++++
plugins/gingerbase/ui/pages/report-add.html.tmpl | 56 ++
.../gingerbase/ui/pages/report-rename.html.tmpl | 56 ++
.../gingerbase/ui/pages/repository-add.html.tmpl | 113 +++
.../gingerbase/ui/pages/repository-edit.html.tmpl | 117 +++
plugins/gingerbase/yumparser.py | 283 +++++++
plugins/kimchi/API.json | 134 ----
plugins/kimchi/Makefile.am | 3 +-
plugins/kimchi/config.py.in | 4 -
plugins/kimchi/control/debugreports.py | 61 --
plugins/kimchi/control/host.py | 96 ---
plugins/kimchi/disks.py | 196 -----
plugins/kimchi/docs/README.md | 6 +-
plugins/kimchi/i18n.py | 50 --
plugins/kimchi/kimchi.conf | 7 -
plugins/kimchi/mockmodel.py | 21 -
plugins/kimchi/model/config.py | 21 -
plugins/kimchi/model/debugreports.py | 213 -----
plugins/kimchi/model/host.py | 320 --------
plugins/kimchi/repositories.py | 529 -------------
plugins/kimchi/root.py | 1 -
plugins/kimchi/swupdate.py | 263 -------
plugins/kimchi/tests/test_authorization.py | 6 -
plugins/kimchi/tests/test_config.py.in | 8 -
plugins/kimchi/tests/test_host.py | 200 -----
plugins/kimchi/tests/test_model.py | 237 ------
plugins/kimchi/tests/test_rest.py | 47 --
plugins/kimchi/ui/config/tab-ext.xml | 7 -
plugins/kimchi/ui/css/theme-default/host.css | 287 -------
plugins/kimchi/ui/css/theme-default/report-add.css | 37 -
.../kimchi/ui/css/theme-default/report-rename.css | 39 -
.../kimchi/ui/css/theme-default/repository-add.css | 42 -
.../ui/css/theme-default/repository-edit.css | 88 ---
plugins/kimchi/ui/js/src/kimchi.api.js | 250 ------
plugins/kimchi/ui/js/src/kimchi.host.js | 858 ---------------------
plugins/kimchi/ui/js/src/kimchi.report_add_main.js | 72 --
.../kimchi/ui/js/src/kimchi.report_rename_main.js | 66 --
.../kimchi/ui/js/src/kimchi.repository_add_main.js | 96 ---
.../ui/js/src/kimchi.repository_edit_main.js | 74 --
plugins/kimchi/ui/pages/help/de_DE/host.dita | 49 --
plugins/kimchi/ui/pages/help/en_US/host.dita | 70 --
plugins/kimchi/ui/pages/help/es_ES/host.dita | 49 --
plugins/kimchi/ui/pages/help/fr_FR/host.dita | 68 --
plugins/kimchi/ui/pages/help/it_IT/host.dita | 51 --
plugins/kimchi/ui/pages/help/ja_JP/host.dita | 70 --
plugins/kimchi/ui/pages/help/ko_KR/host.dita | 47 --
plugins/kimchi/ui/pages/help/pt_BR/host.dita | 74 --
plugins/kimchi/ui/pages/help/ru_RU/host.dita | 48 --
plugins/kimchi/ui/pages/help/zh_CN/host.dita | 45 --
plugins/kimchi/ui/pages/help/zh_TW/host.dita | 50 --
plugins/kimchi/ui/pages/host.html.tmpl | 177 -----
plugins/kimchi/ui/pages/i18n.json.tmpl | 43 --
plugins/kimchi/ui/pages/report-add.html.tmpl | 56 --
plugins/kimchi/ui/pages/report-rename.html.tmpl | 56 --
plugins/kimchi/ui/pages/repository-add.html.tmpl | 113 ---
plugins/kimchi/ui/pages/repository-edit.html.tmpl | 117 ---
plugins/kimchi/yumparser.py | 283 -------
84 files changed, 4548 insertions(+), 5801 deletions(-)
create mode 100644 plugins/gingerbase/control/debugreports.py
create mode 100644 plugins/gingerbase/disks.py
create mode 100644 plugins/gingerbase/model/debugreports.py
create mode 100644 plugins/gingerbase/repositories.py
create mode 100644 plugins/gingerbase/swupdate.py
create mode 100644 plugins/gingerbase/tests/test_host.py
create mode 100644 plugins/gingerbase/ui/css/theme-default/host.css
create mode 100644 plugins/gingerbase/ui/css/theme-default/report-add.css
create mode 100644 plugins/gingerbase/ui/css/theme-default/report-rename.css
create mode 100644 plugins/gingerbase/ui/css/theme-default/repository-add.css
create mode 100644 plugins/gingerbase/ui/css/theme-default/repository-edit.css
create mode 100644 plugins/gingerbase/ui/js/src/gingerbase.host.js
create mode 100644 plugins/gingerbase/ui/js/src/gingerbase.report_add_main.js
create mode 100644 plugins/gingerbase/ui/js/src/gingerbase.report_rename_main.js
create mode 100644 plugins/gingerbase/ui/js/src/gingerbase.repository_add_main.js
create mode 100644 plugins/gingerbase/ui/js/src/gingerbase.repository_edit_main.js
create mode 100644 plugins/gingerbase/ui/pages/help/de_DE/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/en_US/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/es_ES/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/fr_FR/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/it_IT/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/ja_JP/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/ko_KR/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/pt_BR/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/ru_RU/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/zh_CN/host.dita
create mode 100644 plugins/gingerbase/ui/pages/help/zh_TW/host.dita
create mode 100644 plugins/gingerbase/ui/pages/host.html.tmpl
create mode 100644 plugins/gingerbase/ui/pages/report-add.html.tmpl
create mode 100644 plugins/gingerbase/ui/pages/report-rename.html.tmpl
create mode 100644 plugins/gingerbase/ui/pages/repository-add.html.tmpl
create mode 100644 plugins/gingerbase/ui/pages/repository-edit.html.tmpl
create mode 100644 plugins/gingerbase/yumparser.py
delete mode 100644 plugins/kimchi/control/debugreports.py
delete mode 100644 plugins/kimchi/disks.py
delete mode 100644 plugins/kimchi/model/debugreports.py
delete mode 100644 plugins/kimchi/repositories.py
delete mode 100644 plugins/kimchi/swupdate.py
delete mode 100644 plugins/kimchi/tests/test_host.py
delete mode 100644 plugins/kimchi/ui/css/theme-default/host.css
delete mode 100644 plugins/kimchi/ui/css/theme-default/report-add.css
delete mode 100644 plugins/kimchi/ui/css/theme-default/report-rename.css
delete mode 100644 plugins/kimchi/ui/css/theme-default/repository-add.css
delete mode 100644 plugins/kimchi/ui/css/theme-default/repository-edit.css
delete mode 100644 plugins/kimchi/ui/js/src/kimchi.host.js
delete mode 100644 plugins/kimchi/ui/js/src/kimchi.report_add_main.js
delete mode 100644 plugins/kimchi/ui/js/src/kimchi.report_rename_main.js
delete mode 100644 plugins/kimchi/ui/js/src/kimchi.repository_add_main.js
delete mode 100644 plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js
delete mode 100644 plugins/kimchi/ui/pages/help/de_DE/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/en_US/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/es_ES/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/fr_FR/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/it_IT/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/ja_JP/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/ko_KR/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/pt_BR/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/ru_RU/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/zh_CN/host.dita
delete mode 100644 plugins/kimchi/ui/pages/help/zh_TW/host.dita
delete mode 100644 plugins/kimchi/ui/pages/host.html.tmpl
delete mode 100644 plugins/kimchi/ui/pages/report-add.html.tmpl
delete mode 100644 plugins/kimchi/ui/pages/report-rename.html.tmpl
delete mode 100644 plugins/kimchi/ui/pages/repository-add.html.tmpl
delete mode 100644 plugins/kimchi/ui/pages/repository-edit.html.tmpl
delete mode 100644 plugins/kimchi/yumparser.py
diff --git a/plugins/gingerbase/control/debugreports.py b/plugins/gingerbase/control/debugreports.py
new file mode 100644
index 0000000..b5a3072
--- /dev/null
+++ b/plugins/gingerbase/control/debugreports.py
@@ -0,0 +1,61 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2013-2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+from wok.control.base import AsyncCollection, Resource
+from wok.control.utils import internal_redirect
+from wok.control.utils import UrlSubNode
+
+
+ at UrlSubNode('debugreports', True)
+class DebugReports(AsyncCollection):
+ def __init__(self, model):
+ super(DebugReports, self).__init__(model)
+ self.resource = DebugReport
+ self.role_key = 'host'
+ self.admin_methods = ['GET', 'POST']
+
+ def _get_resources(self, filter_params):
+ res_list = super(DebugReports, self)._get_resources(filter_params)
+ return sorted(res_list, key=lambda x: x.data['time'], reverse=True)
+
+
+class DebugReport(Resource):
+ def __init__(self, model, ident):
+ super(DebugReport, self).__init__(model, ident)
+ self.role_key = 'host'
+ self.admin_methods = ['GET', 'PUT', 'POST']
+ self.uri_fmt = '/debugreports/%s'
+ self.content = DebugReportContent(model, ident)
+
+ @property
+ def data(self):
+ return {'name': self.ident,
+ 'uri': self.info['uri'],
+ 'time': self.info['ctime']}
+
+
+class DebugReportContent(Resource):
+ def __init__(self, model, ident):
+ super(DebugReportContent, self).__init__(model, ident)
+ self.role_key = 'host'
+ self.admin_methods = ['GET']
+
+ def get(self):
+ self.lookup()
+ raise internal_redirect(self.info['uri'])
diff --git a/plugins/gingerbase/disks.py b/plugins/gingerbase/disks.py
new file mode 100644
index 0000000..eb40e3a
--- /dev/null
+++ b/plugins/gingerbase/disks.py
@@ -0,0 +1,196 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2013-2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import os.path
+import re
+import subprocess
+from parted import Device as PDevice
+from parted import Disk as PDisk
+
+from wok.exception import OperationFailed
+from wok.utils import wok_log
+
+
+def _get_dev_node_path(maj_min):
+ """ Returns device node path given the device number 'major:min' """
+
+ dm_name = "/sys/dev/block/%s/dm/name" % maj_min
+ if os.path.exists(dm_name):
+ with open(dm_name) as dm_f:
+ content = dm_f.read().rstrip('\n')
+ return "/dev/mapper/" + content
+
+ uevent = "/sys/dev/block/%s/uevent" % maj_min
+ with open(uevent) as ueventf:
+ content = ueventf.read()
+
+ data = dict(re.findall(r'(\S+)=(".*?"|\S+)', content.replace("\n", " ")))
+
+ return "/dev/%s" % data["DEVNAME"]
+
+
+def _get_lsblk_devs(keys, devs=[]):
+ lsblk = subprocess.Popen(
+ ["lsblk", "-Pbo"] + [','.join(keys)] + devs,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = lsblk.communicate()
+ if lsblk.returncode != 0:
+ raise OperationFailed("KCHDISKS0001E", {'err': err})
+
+ return _parse_lsblk_output(out, keys)
+
+
+def _get_dev_major_min(name):
+ maj_min = None
+
+ keys = ["NAME", "MAJ:MIN"]
+ dev_list = _get_lsblk_devs(keys)
+
+ for dev in dev_list:
+ if dev['name'].split()[0] == name:
+ maj_min = dev['maj:min']
+ break
+ else:
+ raise OperationFailed("KCHDISKS0002E", {'device': name})
+
+ return maj_min
+
+
+def _is_dev_leaf(devNodePath):
+ try:
+ # By default, lsblk prints a device information followed by children
+ # device information
+ childrenCount = len(
+ _get_lsblk_devs(["NAME"], [devNodePath])) - 1
+ except OperationFailed as e:
+ # lsblk is known to fail on multipath devices
+ # Assume these devices contain children
+ wok_log.error(
+ "Error getting device info for %s: %s", devNodePath, e)
+ return False
+
+ return childrenCount == 0
+
+
+def _is_dev_extended_partition(devType, devNodePath):
+ if devType != 'part':
+ return False
+ diskPath = devNodePath.rstrip('0123456789')
+ device = PDevice(diskPath)
+ try:
+ extended_part = PDisk(device).getExtendedPartition()
+ except NotImplementedError as e:
+ wok_log.warning(
+ "Error getting extended partition info for dev %s type %s: %s",
+ devNodePath, devType, e.message)
+ # Treate disk with unsupported partiton table as if it does not
+ # contain extended partitions.
+ return False
+ if extended_part and extended_part.path == devNodePath:
+ return True
+ return False
+
+
+def _parse_lsblk_output(output, keys):
+ # output is on format key="value",
+ # where key can be NAME, TYPE, FSTYPE, SIZE, MOUNTPOINT, etc
+ lines = output.rstrip("\n").split("\n")
+ r = []
+ for line in lines:
+ d = {}
+ for key in keys:
+ expression = r"%s=\".*?\"" % key
+ match = re.search(expression, line)
+ field = match.group()
+ k, v = field.split('=', 1)
+ d[k.lower()] = v[1:-1]
+ r.append(d)
+ return r
+
+
+def _get_vgname(devNodePath):
+ """ Return volume group name of a physical volume. If the device node path
+ is not a physical volume, return empty string. """
+ pvs = subprocess.Popen(
+ ["pvs", "--unbuffered", "--nameprefixes", "--noheadings",
+ "-o", "vg_name", devNodePath],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = pvs.communicate()
+ if pvs.returncode != 0:
+ return ""
+
+ return re.findall(r"LVM2_VG_NAME='([^\']*)'", out)[0]
+
+
+def _is_available(name, devtype, fstype, mountpoint, majmin):
+ devNodePath = _get_dev_node_path(majmin)
+ # Only list unmounted and unformated and leaf and (partition or disk)
+ # leaf means a partition, a disk has no partition, or a disk not held
+ # by any multipath device. Physical volume belongs to no volume group
+ # is also listed. Extended partitions should not be listed.
+ if (devtype in ['part', 'disk', 'mpath'] and
+ fstype in ['', 'LVM2_member'] and
+ mountpoint == "" and
+ _get_vgname(devNodePath) == "" and
+ _is_dev_leaf(devNodePath) and
+ not _is_dev_extended_partition(devtype, devNodePath)):
+ return True
+ return False
+
+
+def get_partitions_names(check=False):
+ names = set()
+ keys = ["NAME", "TYPE", "FSTYPE", "MOUNTPOINT", "MAJ:MIN"]
+ # output is on format key="value",
+ # where key can be NAME, TYPE, FSTYPE, MOUNTPOINT
+ for dev in _get_lsblk_devs(keys):
+ # split()[0] to avoid the second part of the name, after the
+ # whiteline
+ name = dev['name'].split()[0]
+ if check and not _is_available(name, dev['type'], dev['fstype'],
+ dev['mountpoint'], dev['maj:min']):
+ continue
+ names.add(name)
+
+ return list(names)
+
+
+def get_partition_details(name):
+ majmin = _get_dev_major_min(name)
+ dev_path = _get_dev_node_path(majmin)
+
+ keys = ["TYPE", "FSTYPE", "SIZE", "MOUNTPOINT"]
+ try:
+ dev = _get_lsblk_devs(keys, [dev_path])[0]
+ except OperationFailed as e:
+ wok_log.error(
+ "Error getting partition info for %s: %s", name, e)
+ return {}
+
+ dev['available'] = _is_available(name, dev['type'], dev['fstype'],
+ dev['mountpoint'], majmin)
+ if dev['mountpoint']:
+ # Sometimes the mountpoint comes with [SWAP] or other
+ # info which is not an actual mount point. Filtering it
+ regexp = re.compile(r"\[.*\]")
+ if regexp.search(dev['mountpoint']) is not None:
+ dev['mountpoint'] = ''
+ dev['path'] = dev_path
+ dev['name'] = name
+ return dev
diff --git a/plugins/gingerbase/model/debugreports.py b/plugins/gingerbase/model/debugreports.py
new file mode 100644
index 0000000..d20eb12
--- /dev/null
+++ b/plugins/gingerbase/model/debugreports.py
@@ -0,0 +1,213 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014-2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import fnmatch
+import glob
+import logging
+import os
+import shutil
+import subprocess
+import time
+
+from wok.exception import InvalidParameter, NotFoundError, OperationFailed
+from wok.exception import WokException
+from wok.utils import add_task, wok_log
+from wok.utils import run_command
+
+from .. import config
+from tasks import TaskModel
+
+
+class DebugReportsModel(object):
+ def __init__(self, **kargs):
+ self.objstore = kargs['objstore']
+ self.task = TaskModel(**kargs)
+
+ def create(self, params):
+ ident = params.get('name').strip()
+ # Generate a name with time and millisec precision, if necessary
+ if ident is None or ident == "":
+ ident = 'report-' + str(int(time.time() * 1000))
+ else:
+ if ident in self.get_list():
+ raise InvalidParameter("KCHDR0008E", {"name": ident})
+ taskid = self._gen_debugreport_file(ident)
+ return self.task.lookup(taskid)
+
+ def get_list(self):
+ path = config.get_debugreports_path()
+ file_pattern = os.path.join(path, '*.*')
+ file_lists = glob.glob(file_pattern)
+ file_lists = [os.path.split(file)[1] for file in file_lists]
+ name_lists = [file.split('.', 1)[0] for file in file_lists]
+
+ return name_lists
+
+ def _gen_debugreport_file(self, name):
+ gen_cmd = self.get_system_report_tool()
+
+ if gen_cmd is not None:
+ return add_task('/plugins/kimchi/debugreports/%s' % name, gen_cmd,
+ self.objstore, name)
+
+ raise OperationFailed("KCHDR0002E")
+
+ @staticmethod
+ def sosreport_generate(cb, name):
+ def log_error(e):
+ log = logging.getLogger('Model')
+ log.warning('Exception in generating debug file: %s', e)
+
+ try:
+ command = ['sosreport', '--batch', '--name=%s' % name]
+ output, error, retcode = run_command(command)
+
+ if retcode != 0:
+ raise OperationFailed("KCHDR0003E", {'name': name,
+ 'err': retcode})
+
+ # SOSREPORT might create file in /tmp or /var/tmp
+ # FIXME: The right way should be passing the tar.xz file directory
+ # though the parameter '--tmp-dir', but it is failing in Fedora 20
+ patterns = ['/tmp/sosreport-%s-*', '/var/tmp/sosreport-%s-*']
+ reports = []
+ reportFile = None
+ for p in patterns:
+ reports = reports + [f for f in glob.glob(p % name)]
+ for f in reports:
+ if not fnmatch.fnmatch(f, '*.md5'):
+ reportFile = f
+ break
+ # Some error in sosreport happened
+ if reportFile is None:
+ wok_log.error('Debug report file not found. See sosreport '
+ 'output for detail:\n%s', output)
+ fname = (patterns[0] % name).split('/')[-1]
+ raise OperationFailed('KCHDR0004E', {'name': fname})
+
+ md5_report_file = reportFile + '.md5'
+ report_file_extension = '.' + reportFile.split('.', 1)[1]
+ path = config.get_debugreports_path()
+ target = os.path.join(path, name + report_file_extension)
+ # Moving report
+ msg = 'Moving debug report file "%s" to "%s"' % (reportFile,
+ target)
+ wok_log.info(msg)
+ shutil.move(reportFile, target)
+ # Deleting md5
+ msg = 'Deleting report md5 file: "%s"' % (md5_report_file)
+ wok_log.info(msg)
+ with open(md5_report_file) as f:
+ md5 = f.read().strip()
+ wok_log.info('Md5 file content: "%s"', md5)
+ os.remove(md5_report_file)
+ cb('OK', True)
+ return
+
+ except WokException as e:
+ log_error(e)
+ raise
+
+ except OSError as e:
+ log_error(e)
+ raise
+
+ except Exception, e:
+ # No need to call cb to update the task status here.
+ # The task object will catch the exception raised here
+ # and update the task status there
+ log_error(e)
+ raise OperationFailed("KCHDR0005E", {'name': name, 'err': e})
+
+ @staticmethod
+ def get_system_report_tool():
+ # Please add new possible debug report command here
+ # and implement the report generating function
+ # based on the new report command
+ report_tools = ({'cmd': 'sosreport --help',
+ 'fn': DebugReportsModel.sosreport_generate},)
+
+ # check if the command can be found by shell one by one
+ for helper_tool in report_tools:
+ try:
+ retcode = subprocess.call(helper_tool['cmd'], shell=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ if retcode == 0:
+ return helper_tool['fn']
+ except Exception, e:
+ wok_log.info('Exception running command: %s', e)
+
+ return None
+
+
+class DebugReportModel(object):
+ def __init__(self, **kargs):
+ pass
+
+ def lookup(self, name):
+ path = config.get_debugreports_path()
+ file_pattern = os.path.join(path, name)
+ file_pattern = file_pattern + '.*'
+ try:
+ file_target = glob.glob(file_pattern)[0]
+ except IndexError:
+ raise NotFoundError("KCHDR0001E", {'name': name})
+
+ ctime = os.stat(file_target).st_mtime
+ ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
+ file_target = os.path.split(file_target)[-1]
+ file_target = os.path.join("plugins/kimchi/data/debugreports",
+ file_target)
+ return {'uri': file_target,
+ 'ctime': ctime}
+
+ def update(self, name, params):
+ path = config.get_debugreports_path()
+ file_pattern = os.path.join(path, name + '.*')
+ try:
+ file_source = glob.glob(file_pattern)[0]
+ except IndexError:
+ raise NotFoundError("KCHDR0001E", {'name': name})
+
+ file_target = file_source.replace(name, params['name'])
+ if os.path.isfile(file_target):
+ raise InvalidParameter('KCHDR0008E', {'name': params['name']})
+
+ shutil.move(file_source, file_target)
+ wok_log.info('%s renamed to %s' % (file_source, file_target))
+ return params['name']
+
+ def delete(self, name):
+ path = config.get_debugreports_path()
+ file_pattern = os.path.join(path, name + '.*')
+ try:
+ file_target = glob.glob(file_pattern)[0]
+ except IndexError:
+ raise NotFoundError("KCHDR0001E", {'name': name})
+
+ os.remove(file_target)
+
+
+class DebugReportContentModel(object):
+ def __init__(self, **kargs):
+ self._debugreport = DebugReportModel()
+
+ def lookup(self, name):
+ return self._debugreport.lookup(name)
diff --git a/plugins/gingerbase/repositories.py b/plugins/gingerbase/repositories.py
new file mode 100644
index 0000000..9caabc4
--- /dev/null
+++ b/plugins/gingerbase/repositories.py
@@ -0,0 +1,529 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014-2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import copy
+import os
+import time
+import urlparse
+from ConfigParser import ConfigParser
+
+from wok.basemodel import Singleton
+from wok.exception import InvalidOperation, InvalidParameter
+from wok.exception import OperationFailed, NotFoundError, MissingParameter
+from wok.utils import validate_repo_url
+
+from config import kimchiLock
+from yumparser import get_yum_repositories, write_repo_to_file
+
+
+class Repositories(object):
+ __metaclass__ = Singleton
+
+ """
+ Class to represent and operate with repositories information.
+ """
+ def __init__(self):
+ try:
+ __import__('yum')
+ self._pkg_mnger = YumRepo()
+ except ImportError:
+ try:
+ __import__('apt_pkg')
+ self._pkg_mnger = AptRepo()
+ except ImportError:
+ raise InvalidOperation('KCHREPOS0014E')
+
+ def addRepository(self, params):
+ """
+ Add and enable a new repository
+ """
+ config = params.get('config', {})
+ extra_keys = list(
+ set(config.keys()).difference(set(self._pkg_mnger.CONFIG_ENTRY)))
+ if len(extra_keys) > 0:
+ raise InvalidParameter("KCHREPOS0028E",
+ {'items': ",".join(extra_keys)})
+
+ return self._pkg_mnger.addRepo(params)
+
+ def getRepositories(self):
+ """
+ Return a dictionary with all Kimchi's repositories. Each element uses
+ the format {<repo_id>: {repo}}, where repo is a dictionary in the
+ repositories.Repositories() format.
+ """
+ return self._pkg_mnger.getRepositoriesList()
+
+ def getRepository(self, repo_id):
+ """
+ Return a dictionary with all info from a given repository ID.
+ """
+ info = self._pkg_mnger.getRepo(repo_id)
+ info['repo_id'] = repo_id
+ return info
+
+ def enableRepository(self, repo_id):
+ """
+ Enable a repository.
+ """
+ return self._pkg_mnger.toggleRepo(repo_id, True)
+
+ def disableRepository(self, repo_id):
+ """
+ Disable a given repository.
+ """
+ return self._pkg_mnger.toggleRepo(repo_id, False)
+
+ def updateRepository(self, repo_id, params):
+ """
+ Update the information of a given repository.
+ The input is the repo_id of the repository to be updated and a dict
+ with the information to be updated.
+ """
+ return self._pkg_mnger.updateRepo(repo_id, params)
+
+ def removeRepository(self, repo_id):
+ """
+ Remove a given repository
+ """
+ return self._pkg_mnger.removeRepo(repo_id)
+
+
+class YumRepo(object):
+ """
+ Class to represent and operate with YUM repositories.
+ It's loaded only on those systems listed at YUM_DISTROS and loads necessary
+ modules in runtime.
+ """
+ TYPE = 'yum'
+ DEFAULT_CONF_DIR = "/etc/yum.repos.d"
+ CONFIG_ENTRY = ('repo_name', 'mirrorlist', 'metalink')
+
+ def __init__(self):
+ self._confdir = self.DEFAULT_CONF_DIR
+
+ def _get_repos(self, errcode):
+ try:
+ kimchiLock.acquire()
+ repos = get_yum_repositories()
+ except Exception, e:
+ kimchiLock.release()
+ raise OperationFailed(errcode, {'err': str(e)})
+ finally:
+ kimchiLock.release()
+
+ return repos
+
+ def getRepositoriesList(self):
+ """
+ Return a list of repositories IDs
+ """
+ repos = self._get_repos('KCHREPOS0024E')
+ return repos.keys()
+
+ def getRepo(self, repo_id):
+ """
+ Return a dictionary in the repositories.Repositories() of the given
+ repository ID format with the information of a YumRepository object.
+ """
+ repos = self._get_repos('KCHREPOS0025E')
+
+ if repo_id not in repos.keys():
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ entry = repos.get(repo_id)
+
+ info = {}
+ info['enabled'] = entry.enabled
+ info['baseurl'] = entry.baseurl or ''
+ info['config'] = {}
+ info['config']['repo_name'] = entry.name or ''
+ info['config']['gpgcheck'] = entry.gpgcheck
+ info['config']['gpgkey'] = entry.gpgkey or ''
+ info['config']['mirrorlist'] = entry.mirrorlist or ''
+ info['config']['metalink'] = entry.metalink or ''
+ return info
+
+ def addRepo(self, params):
+ """
+ Add a given repository to YumBase
+ """
+ # At least one base url, or one mirror, must be given.
+ baseurl = params.get('baseurl', '')
+
+ config = params.get('config', {})
+ mirrorlist = config.get('mirrorlist', '')
+ metalink = config.get('metalink', '')
+ if not baseurl and not mirrorlist and not metalink:
+ raise MissingParameter("KCHREPOS0013E")
+
+ if baseurl:
+ validate_repo_url(baseurl)
+
+ if mirrorlist:
+ validate_repo_url(mirrorlist)
+
+ if metalink:
+ validate_repo_url(metalink)
+
+ if mirrorlist and metalink:
+ raise InvalidOperation('KCHREPOS0030E')
+
+ repo_id = params.get('repo_id', None)
+ if repo_id is None:
+ repo_id = "kimchi_repo_%s" % str(int(time.time() * 1000))
+
+ repos = self._get_repos('KCHREPOS0026E')
+ if repo_id in repos.keys():
+ raise InvalidOperation("KCHREPOS0022E", {'repo_id': repo_id})
+
+ repo_name = config.get('repo_name', repo_id)
+ repo = {'baseurl': baseurl, 'mirrorlist': mirrorlist,
+ 'name': repo_name, 'gpgcheck': 1,
+ 'gpgkey': [], 'enabled': 1, 'metalink': metalink}
+
+ # write a repo file in the system with repo{} information.
+ parser = ConfigParser()
+ parser.add_section(repo_id)
+
+ for key, value in repo.iteritems():
+ if value:
+ parser.set(repo_id, key, value)
+
+ repofile = os.path.join(self._confdir, repo_id + '.repo')
+ try:
+ with open(repofile, 'w') as fd:
+ parser.write(fd)
+ except:
+ raise OperationFailed("KCHREPOS0018E",
+ {'repo_file': repofile})
+
+ return repo_id
+
+ def toggleRepo(self, repo_id, enable):
+ repos = self._get_repos('KCHREPOS0011E')
+ if repo_id not in repos.keys():
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ entry = repos.get(repo_id)
+ if enable and entry.enabled:
+ raise InvalidOperation("KCHREPOS0015E", {'repo_id': repo_id})
+
+ if not enable and not entry.enabled:
+ raise InvalidOperation("KCHREPOS0016E", {'repo_id': repo_id})
+
+ kimchiLock.acquire()
+ try:
+ if enable:
+ entry.enable()
+ else:
+ entry.disable()
+
+ write_repo_to_file(entry)
+ except:
+ if enable:
+ raise OperationFailed("KCHREPOS0020E", {'repo_id': repo_id})
+
+ raise OperationFailed("KCHREPOS0021E", {'repo_id': repo_id})
+ finally:
+ kimchiLock.release()
+
+ return repo_id
+
+ def updateRepo(self, repo_id, params):
+ """
+ Update a given repository in repositories.Repositories() format
+ """
+ repos = self._get_repos('KCHREPOS0011E')
+ if repo_id not in repos.keys():
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ entry = repos.get(repo_id)
+
+ baseurl = params.get('baseurl', None)
+ config = params.get('config', {})
+ mirrorlist = config.get('mirrorlist', None)
+ metalink = config.get('metalink', None)
+
+ if baseurl is not None and len(baseurl.strip()) == 0:
+ baseurl = None
+
+ if mirrorlist is not None and len(mirrorlist.strip()) == 0:
+ mirrorlist = None
+
+ if metalink is not None and len(metalink.strip()) == 0:
+ metalink = None
+
+ if baseurl is None and mirrorlist is None and metalink is None:
+ raise MissingParameter("KCHREPOS0013E")
+
+ if baseurl is not None:
+ validate_repo_url(baseurl)
+ entry.baseurl = baseurl
+
+ if mirrorlist is not None:
+ validate_repo_url(mirrorlist)
+ entry.mirrorlist = mirrorlist
+
+ if metalink is not None:
+ validate_repo_url(metalink)
+ entry.metalink = metalink
+
+ if mirrorlist and metalink:
+ raise InvalidOperation('KCHREPOS0030E')
+
+ entry.id = params.get('repo_id', repo_id)
+ entry.name = config.get('repo_name', entry.name)
+ entry.gpgcheck = config.get('gpgcheck', entry.gpgcheck)
+ entry.gpgkey = config.get('gpgkey', entry.gpgkey)
+ kimchiLock.acquire()
+ write_repo_to_file(entry)
+ kimchiLock.release()
+ return repo_id
+
+ def removeRepo(self, repo_id):
+ """
+ Remove a given repository
+ """
+ repos = self._get_repos('KCHREPOS0027E')
+ if repo_id not in repos.keys():
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ entry = repos.get(repo_id)
+ parser = ConfigParser()
+ with open(entry.repofile) as fd:
+ parser.readfp(fd)
+
+ if len(parser.sections()) == 1:
+ os.remove(entry.repofile)
+ return
+
+ parser.remove_section(repo_id)
+ with open(entry.repofile, "w") as fd:
+ parser.write(fd)
+
+
+class AptRepo(object):
+ """
+ Class to represent and operate with YUM repositories.
+ It's loaded only on those systems listed at YUM_DISTROS and loads necessary
+ modules in runtime.
+ """
+ TYPE = 'deb'
+ KIMCHI_LIST = "kimchi-source.list"
+ CONFIG_ENTRY = ('dist', 'comps')
+
+ def __init__(self):
+ getattr(__import__('apt_pkg'), 'init_config')()
+ getattr(__import__('apt_pkg'), 'init_system')()
+ config = getattr(__import__('apt_pkg'), 'config')
+ self.pkg_lock = getattr(__import__('apt_pkg'), 'SystemLock')
+ module = __import__('aptsources.sourceslist', globals(), locals(),
+ ['SourcesList'], -1)
+
+ self._sourceparts_path = '/%s%s' % (
+ config.get('Dir::Etc'), config.get('Dir::Etc::sourceparts'))
+ self._sourceslist = getattr(module, 'SourcesList')
+ self.filename = os.path.join(self._sourceparts_path, self.KIMCHI_LIST)
+ if not os.path.exists(self.filename):
+ with open(self.filename, 'w') as fd:
+ fd.write("# This file is managed by Kimchi and it must not "
+ "be modified manually\n")
+
+ def _get_repos(self):
+ try:
+ with self.pkg_lock():
+ repos = self._sourceslist()
+ repos.refresh()
+ except Exception, e:
+ kimchiLock.release()
+ raise OperationFailed('KCHREPOS0025E', {'err': e.message})
+
+ return repos
+
+ def _get_repo_id(self, repo):
+ data = urlparse.urlparse(repo.uri)
+ name = data.hostname or data.path
+ return '%s-%s-%s' % (name, repo.dist, "-".join(repo.comps))
+
+ def _get_source_entry(self, repo_id):
+ kimchiLock.acquire()
+ repos = self._get_repos()
+ kimchiLock.release()
+
+ for r in repos:
+ # Ignore deb-src repositories
+ if r.type != 'deb':
+ continue
+
+ if self._get_repo_id(r) != repo_id:
+ continue
+
+ return r
+
+ return None
+
+ def getRepositoriesList(self):
+ """
+ Return a list of repositories IDs
+
+ APT repositories there aren't the concept about repository ID, so for
+ internal control, the repository ID will be built as described in
+ _get_repo_id()
+ """
+ kimchiLock.acquire()
+ repos = self._get_repos()
+ kimchiLock.release()
+
+ res = []
+ for r in repos:
+ # Ignore deb-src repositories
+ if r.type != 'deb':
+ continue
+
+ res.append(self._get_repo_id(r))
+
+ return res
+
+ def getRepo(self, repo_id):
+ """
+ Return a dictionary in the repositories.Repositories() format of the
+ given repository ID with the information of a SourceEntry object.
+ """
+ r = self._get_source_entry(repo_id)
+ if r is None:
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ info = {'enabled': not r.disabled,
+ 'baseurl': r.uri,
+ 'config': {'dist': r.dist,
+ 'comps': r.comps}}
+ return info
+
+ def addRepo(self, params):
+ """
+ Add a new APT repository based on <params>
+ """
+ # To create a APT repository the dist is a required parameter
+ # (in addition to baseurl, verified on controller through API.json)
+ config = params.get('config', None)
+ if config is None:
+ raise MissingParameter("KCHREPOS0019E")
+
+ if 'dist' not in config.keys():
+ raise MissingParameter("KCHREPOS0019E")
+
+ uri = params['baseurl']
+ dist = config['dist']
+ comps = config.get('comps', [])
+
+ validate_repo_url(uri)
+
+ kimchiLock.acquire()
+ try:
+ repos = self._get_repos()
+ source_entry = repos.add('deb', uri, dist, comps,
+ file=self.filename)
+ with self.pkg_lock():
+ repos.save()
+ except Exception as e:
+ kimchiLock.release()
+ raise OperationFailed("KCHREPOS0026E", {'err': e.message})
+ kimchiLock.release()
+ return self._get_repo_id(source_entry)
+
+ def toggleRepo(self, repo_id, enable):
+ """
+ Enable a given repository
+ """
+ r = self._get_source_entry(repo_id)
+ if r is None:
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ if enable and not r.disabled:
+ raise InvalidOperation("KCHREPOS0015E", {'repo_id': repo_id})
+
+ if not enable and r.disabled:
+ raise InvalidOperation("KCHREPOS0016E", {'repo_id': repo_id})
+
+ if enable:
+ line = 'deb'
+ else:
+ line = '#deb'
+
+ kimchiLock.acquire()
+ try:
+ repos = self._get_repos()
+ with self.pkg_lock():
+ repos.remove(r)
+ repos.add(line, r.uri, r.dist, r.comps, file=self.filename)
+ repos.save()
+ except:
+ kimchiLock.release()
+ if enable:
+ raise OperationFailed("KCHREPOS0020E", {'repo_id': repo_id})
+
+ raise OperationFailed("KCHREPOS0021E", {'repo_id': repo_id})
+ finally:
+ kimchiLock.release()
+
+ return repo_id
+
+ def updateRepo(self, repo_id, params):
+ """
+ Update a given repository in repositories.Repositories() format
+ """
+ old_info = self.getRepo(repo_id)
+ updated_info = copy.deepcopy(old_info)
+ updated_info['baseurl'] = params.get(
+ 'baseurl', updated_info['baseurl'])
+
+ if 'config' in params.keys():
+ config = params['config']
+ updated_info['config']['dist'] = config.get(
+ 'dist', old_info['config']['dist'])
+ updated_info['config']['comps'] = config.get(
+ 'comps', old_info['config']['comps'])
+
+ self.removeRepo(repo_id)
+ try:
+ return self.addRepo(updated_info)
+ except:
+ self.addRepo(old_info)
+ raise
+
+ def removeRepo(self, repo_id):
+ """
+ Remove a given repository
+ """
+ r = self._get_source_entry(repo_id)
+ if r is None:
+ raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
+
+ kimchiLock.acquire()
+ try:
+ repos = self._get_repos()
+ with self.pkg_lock():
+ repos.remove(r)
+ repos.save()
+ except:
+ kimchiLock.release()
+ raise OperationFailed("KCHREPOS0017E", {'repo_id': repo_id})
+ finally:
+ kimchiLock.release()
diff --git a/plugins/gingerbase/swupdate.py b/plugins/gingerbase/swupdate.py
new file mode 100644
index 0000000..84b927f
--- /dev/null
+++ b/plugins/gingerbase/swupdate.py
@@ -0,0 +1,263 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014-2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import subprocess
+import time
+
+from wok.basemodel import Singleton
+from wok.exception import NotFoundError, OperationFailed
+from wok.utils import run_command, wok_log
+
+from config import kimchiLock
+from yumparser import get_yum_packages_list_update
+
+
+class SoftwareUpdate(object):
+ __metaclass__ = Singleton
+
+ """
+ Class to represent and operate with OS software update.
+ """
+ def __init__(self):
+ # This stores all packages to be updated for Kimchi perspective. It's a
+ # dictionary of dictionaries, in the format {'package_name': package},
+ # where:
+ # package = {'package_name': <string>, 'version': <string>,
+ # 'arch': <string>, 'repository': <string>
+ # }
+ self._packages = {}
+
+ # This stores the number of packages to update
+ self._num2update = 0
+
+ # Get the distro of host machine and creates an object related to
+ # correct package management system
+ try:
+ __import__('yum')
+ wok_log.info("Loading YumUpdate features.")
+ self._pkg_mnger = YumUpdate()
+ except ImportError:
+ try:
+ __import__('apt')
+ wok_log.info("Loading AptUpdate features.")
+ self._pkg_mnger = AptUpdate()
+ except ImportError:
+ zypper_help = ["zypper", "--help"]
+ (stdout, stderr, returncode) = run_command(zypper_help)
+ if returncode == 0:
+ wok_log.info("Loading ZypperUpdate features.")
+ self._pkg_mnger = ZypperUpdate()
+ else:
+ raise Exception("There is no compatible package manager "
+ "for this system.")
+
+ def _scanUpdates(self):
+ """
+ Update self._packages with packages to be updated.
+ """
+ self._packages = {}
+ self._num2update = 0
+
+ # Call system pkg_mnger to get the packages as list of dictionaries.
+ for pkg in self._pkg_mnger.getPackagesList():
+
+ # Check if already exist a package in self._packages
+ pkg_id = pkg.get('package_name')
+ if pkg_id in self._packages.keys():
+ # package already listed to update. do nothing
+ continue
+
+ # Update the self._packages and self._num2update
+ self._packages[pkg_id] = pkg
+ self._num2update = self._num2update + 1
+
+ def getUpdates(self):
+ """
+ Return the self._packages.
+ """
+ self._scanUpdates()
+ return self._packages
+
+ def getUpdate(self, name):
+ """
+ Return a dictionary with all info from a given package name.
+ """
+ if name not in self._packages.keys():
+ raise NotFoundError('KCHPKGUPD0002E', {'name': name})
+
+ return self._packages[name]
+
+ def getNumOfUpdates(self):
+ """
+ Return the number of packages to be updated.
+ """
+ self._scanUpdates()
+ return self._num2update
+
+ def doUpdate(self, cb, params):
+ """
+ Execute the update
+ """
+ # reset messages
+ cb('')
+
+ cmd = self._pkg_mnger.update_cmd
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ msgs = []
+ while proc.poll() is None:
+ msgs.append(proc.stdout.readline())
+ cb(''.join(msgs))
+ time.sleep(0.5)
+
+ # read the final output lines
+ msgs.extend(proc.stdout.readlines())
+
+ retcode = proc.poll()
+ if retcode == 0:
+ return cb(''.join(msgs), True)
+
+ msgs.extend(proc.stderr.readlines())
+ return cb(''.join(msgs), False)
+
+
+class YumUpdate(object):
+ """
+ Class to represent and operate with YUM software update system.
+ It's loaded only on those systems listed at YUM_DISTROS and loads necessary
+ modules in runtime.
+ """
+ def __init__(self):
+ self._pkgs = {}
+ self.update_cmd = ["yum", "-y", "update"]
+
+ def _refreshUpdateList(self):
+ """
+ Update the list of packages to be updated in the system.
+ """
+ try:
+ kimchiLock.acquire()
+ self._pkgs = get_yum_packages_list_update()
+ except Exception, e:
+ raise OperationFailed('KCHPKGUPD0003E', {'err': str(e)})
+ finally:
+ kimchiLock.release()
+
+ def getPackagesList(self):
+ """
+ Return a list of package's dictionaries. Each dictionary contains the
+ information about a package, in the format:
+ package = {'package_name': <string>, 'version': <string>,
+ 'arch': <string>, 'repository': <string>}
+ """
+ self._refreshUpdateList()
+ pkg_list = []
+ for pkg in self._pkgs:
+ package = {'package_name': pkg.name, 'version': pkg.version,
+ 'arch': pkg.arch, 'repository': pkg.ui_from_repo}
+ pkg_list.append(package)
+ return pkg_list
+
+
+class AptUpdate(object):
+ """
+ Class to represent and operate with APT software update system.
+ It's loaded only on those systems listed at APT_DISTROS and loads necessary
+ modules in runtime.
+ """
+ def __init__(self):
+ self._pkgs = {}
+ self.pkg_lock = getattr(__import__('apt_pkg'), 'SystemLock')
+ self.update_cmd = ['apt-get', 'upgrade', '-y']
+
+ def _refreshUpdateList(self):
+ """
+ Update the list of packages to be updated in the system.
+ """
+ apt_cache = getattr(__import__('apt'), 'Cache')()
+ try:
+ with self.pkg_lock():
+ apt_cache.update()
+ apt_cache.upgrade()
+ self._pkgs = apt_cache.get_changes()
+ except Exception, e:
+ kimchiLock.release()
+ raise OperationFailed('KCHPKGUPD0003E', {'err': e.message})
+
+ def getPackagesList(self):
+ """
+ Return a list of package's dictionaries. Each dictionary contains the
+ information about a package, in the format
+ package = {'package_name': <string>, 'version': <string>,
+ 'arch': <string>, 'repository': <string>}
+ """
+ kimchiLock.acquire()
+ self._refreshUpdateList()
+ kimchiLock.release()
+ pkg_list = []
+ for pkg in self._pkgs:
+ package = {'package_name': pkg.shortname,
+ 'version': pkg.candidate.version,
+ 'arch': pkg._pkg.architecture,
+ 'repository': pkg.candidate.origins[0].label}
+ pkg_list.append(package)
+
+ return pkg_list
+
+
+class ZypperUpdate(object):
+ """
+ Class to represent and operate with Zypper software update system.
+ It's loaded only on those systems listed at ZYPPER_DISTROS and loads
+ necessary modules in runtime.
+ """
+ def __init__(self):
+ self._pkgs = {}
+ self.update_cmd = ["zypper", "--non-interactive", "update",
+ "--auto-agree-with-licenses"]
+
+ def _refreshUpdateList(self):
+ """
+ Update the list of packages to be updated in the system.
+ """
+ self._pkgs = []
+ cmd = ["zypper", "list-updates"]
+ (stdout, stderr, returncode) = run_command(cmd)
+
+ if len(stderr) > 0:
+ raise OperationFailed('KCHPKGUPD0003E', {'err': stderr})
+
+ for line in stdout.split('\n'):
+ if line.find('v |') >= 0:
+ info = line.split(' | ')
+ package = {'package_name': info[2], 'version': info[4],
+ 'arch': info[5], 'repository': info[1]}
+ self._pkgs.append(package)
+
+ def getPackagesList(self):
+ """
+ Return a list of package's dictionaries. Each dictionary contains the
+ information about a package, in the format
+ package = {'package_name': <string>, 'version': <string>,
+ 'arch': <string>, 'repository': <string>}
+ """
+ kimchiLock.acquire()
+ self._refreshUpdateList()
+ kimchiLock.release()
+ return self._pkgs
diff --git a/plugins/gingerbase/tests/test_host.py b/plugins/gingerbase/tests/test_host.py
new file mode 100644
index 0000000..e2aa196
--- /dev/null
+++ b/plugins/gingerbase/tests/test_host.py
@@ -0,0 +1,200 @@
+# -*- coding: utf-8 -*-
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import json
+import os
+import platform
+import psutil
+import tempfile
+import time
+import unittest
+from functools import partial
+
+from wok.plugins.kimchi.mockmodel import MockModel
+
+from utils import get_free_port, patch_auth, request, run_server, wait_task
+
+
+test_server = None
+model = None
+host = None
+ssl_port = None
+tmpfile = None
+
+
+def setUpModule():
+ global test_server, model, host, ssl_port, tmpfile
+
+ patch_auth()
+ tmpfile = tempfile.mktemp()
+ model = MockModel(tmpfile)
+ host = '127.0.0.1'
+ port = get_free_port('http')
+ ssl_port = get_free_port('https')
+ cherrypy_port = get_free_port('cherrypy_port')
+ test_server = run_server(host, port, ssl_port, test_mode=True,
+ cherrypy_port=cherrypy_port, model=model)
+
+
+def tearDownModule():
+ test_server.stop()
+ os.unlink(tmpfile)
+
+
+class HostTests(unittest.TestCase):
+ def setUp(self):
+ self.request = partial(request, host, ssl_port)
+
+ def test_hostinfo(self):
+ resp = self.request('/plugins/kimchi/host').read()
+ info = json.loads(resp)
+ keys = ['os_distro', 'os_version', 'os_codename', 'cpu_model',
+ 'memory', 'cpus']
+ self.assertEquals(sorted(keys), sorted(info.keys()))
+
+ distro, version, codename = platform.linux_distribution()
+ self.assertEquals(distro, info['os_distro'])
+ self.assertEquals(version, info['os_version'])
+ self.assertEquals(unicode(codename, "utf-8"), info['os_codename'])
+ self.assertEquals(psutil.TOTAL_PHYMEM, info['memory'])
+
+ def test_hoststats(self):
+ time.sleep(1)
+ stats_keys = ['cpu_utilization', 'memory', 'disk_read_rate',
+ 'disk_write_rate', 'net_recv_rate', 'net_sent_rate']
+ resp = self.request('/plugins/kimchi/host/stats').read()
+ stats = json.loads(resp)
+ self.assertEquals(sorted(stats_keys), sorted(stats.keys()))
+
+ cpu_utilization = stats['cpu_utilization']
+ self.assertIsInstance(cpu_utilization, float)
+ self.assertGreaterEqual(cpu_utilization, 0.0)
+ self.assertTrue(cpu_utilization <= 100.0)
+
+ memory_stats = stats['memory']
+ self.assertIn('total', memory_stats)
+ self.assertIn('free', memory_stats)
+ self.assertIn('cached', memory_stats)
+ self.assertIn('buffers', memory_stats)
+ self.assertIn('avail', memory_stats)
+
+ resp = self.request('/plugins/kimchi/host/stats/history').read()
+ history = json.loads(resp)
+ self.assertEquals(sorted(stats_keys), sorted(history.keys()))
+
+ def test_host_actions(self):
+ def _task_lookup(taskid):
+ return json.loads(self.request('/plugins/kimchi/tasks/%s' %
+ taskid).read())
+
+ resp = self.request('/plugins/kimchi/host/shutdown', '{}', 'POST')
+ self.assertEquals(200, resp.status)
+ resp = self.request('/plugins/kimchi/host/reboot', '{}', 'POST')
+ self.assertEquals(200, resp.status)
+
+ # Test system update
+ resp = self.request('/plugins/kimchi/host/packagesupdate', None, 'GET')
+ pkgs = json.loads(resp.read())
+ self.assertEquals(3, len(pkgs))
+
+ pkg_keys = ['package_name', 'repository', 'arch', 'version']
+ for p in pkgs:
+ name = p['package_name']
+ resp = self.request('/plugins/kimchi/host/packagesupdate/' + name,
+ None, 'GET')
+ info = json.loads(resp.read())
+ self.assertEquals(sorted(pkg_keys), sorted(info.keys()))
+
+ resp = self.request('/plugins/kimchi/host/swupdate', '{}', 'POST')
+ task = json.loads(resp.read())
+ task_params = [u'id', u'message', u'status', u'target_uri']
+ self.assertEquals(sorted(task_params), sorted(task.keys()))
+
+ resp = self.request('/plugins/kimchi/tasks/' + task[u'id'], None, 'GET')
+ task_info = json.loads(resp.read())
+ self.assertEquals(task_info['status'], 'running')
+ wait_task(_task_lookup, task_info['id'])
+ resp = self.request('/plugins/kimchi/tasks/' + task[u'id'], None, 'GET')
+ task_info = json.loads(resp.read())
+ self.assertEquals(task_info['status'], 'finished')
+ self.assertIn(u'All packages updated', task_info['message'])
+ pkgs = model.packagesupdate_get_list()
+ self.assertEquals(0, len(pkgs))
+
+ def test_host_partitions(self):
+ resp = self.request('/plugins/kimchi/host/partitions')
+ self.assertEquals(200, resp.status)
+ partitions = json.loads(resp.read())
+
+ keys = ['name', 'path', 'type', 'fstype', 'size', 'mountpoint',
+ 'available']
+ for item in partitions:
+ resp = self.request('/plugins/kimchi/host/partitions/%s' %
+ item['name'])
+ info = json.loads(resp.read())
+ self.assertEquals(sorted(info.keys()), sorted(keys))
+
+ def test_host_devices(self):
+ def asset_devices_type(devices, dev_type):
+ for dev in devices:
+ self.assertEquals(dev['device_type'], dev_type)
+
+ resp = self.request('/plugins/kimchi/host/devices?_cap=scsi_host')
+ nodedevs = json.loads(resp.read())
+ # Mockmodel brings 3 preconfigured scsi fc_host
+ self.assertEquals(3, len(nodedevs))
+
+ nodedev = json.loads(self.request(
+ '/plugins/kimchi/host/devices/scsi_host2').read())
+ # Mockmodel generates random wwpn and wwnn
+ self.assertEquals('scsi_host2', nodedev['name'])
+ self.assertEquals('fc_host', nodedev['adapter']['type'])
+ self.assertEquals(16, len(nodedev['adapter']['wwpn']))
+ self.assertEquals(16, len(nodedev['adapter']['wwnn']))
+
+ devs = json.loads(self.request('/plugins/kimchi/host/devices').read())
+ dev_names = [dev['name'] for dev in devs]
+ for dev_type in ('pci', 'usb_device', 'scsi'):
+ resp = self.request('/plugins/kimchi/host/devices?_cap=%s' %
+ dev_type)
+ devsByType = json.loads(resp.read())
+ names = [dev['name'] for dev in devsByType]
+ self.assertTrue(set(names) <= set(dev_names))
+ asset_devices_type(devsByType, dev_type)
+
+ resp = self.request('/plugins/kimchi/host/devices?_passthrough=true')
+ passthru_devs = [dev['name'] for dev in json.loads(resp.read())]
+ self.assertTrue(set(passthru_devs) <= set(dev_names))
+
+ for dev_type in ('pci', 'usb_device', 'scsi'):
+ resp = self.request(
+ '/plugins/kimchi/host/devices?_cap=%s&_passthrough=true' %
+ dev_type)
+ filteredDevs = json.loads(resp.read())
+ filteredNames = [dev['name'] for dev in filteredDevs]
+ self.assertTrue(set(filteredNames) <= set(dev_names))
+ asset_devices_type(filteredDevs, dev_type)
+
+ for dev in passthru_devs:
+ resp = self.request(
+ '/plugins/kimchi/host/devices?_passthrough_affected_by=%s' %
+ dev)
+ affected_devs = [dev['name'] for dev in json.loads(resp.read())]
+ self.assertTrue(set(affected_devs) <= set(dev_names))
diff --git a/plugins/gingerbase/ui/css/theme-default/host.css b/plugins/gingerbase/ui/css/theme-default/host.css
new file mode 100644
index 0000000..a0cccb1
--- /dev/null
+++ b/plugins/gingerbase/ui/css/theme-default/host.css
@@ -0,0 +1,287 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-2014
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.host-panel {
+ font-size: 12px;
+ margin-bottom: 100px;
+}
+
+.host-panel .logo-container, .host-panel .info-container,
+.host-panel .section-label, .host-panel .section-value {
+ display: inline-block;
+ vertical-align: top;
+}
+
+.host-panel .section-label {
+ display: inline-block;
+ margin-right: 1em;
+ vertical-align: top;
+}
+
+.host-panel .logo {
+ background: url("plugins/kimchi/images/icon-vm.png") no-repeat left top;
+ height: 128px;
+ width: 128px;
+}
+
+.host-panel .hostname {
+ text-decoration: underline;
+}
+
+.host-panel .action-panel {
+ margin-top: 2em;
+ padding-left: 10px;
+}
+
+.host-panel .button-icon {
+ background: url("../images/theme-default/host-icon-sprite.png") no-repeat
+ left top;
+ display: inline-block;
+ height: 12px;
+ width: 12px;
+}
+
+.host-panel .action-icon-stop {
+ background-position: -14px 0;
+}
+
+.host-panel .action-icon-restart {
+ background-position: -28px 0;
+}
+
+.host-panel .action-icon-download {
+ background-position: -42px 0;
+}
+
+.host-panel .action-icon-connect {
+ background-position: -56px 0;
+}
+
+.host-panel .action-icon-add {
+ background-position: -70px 0;
+}
+
+.host-panel .action-icon-edit {
+ background-position: -84px 0;
+}
+
+.host-panel .action-icon-remove {
+ background-position: -98px 0;
+}
+
+.host-panel button:disabled .action-icon-start {
+ background-position: 0 -14px;
+}
+
+.host-panel button:disabled .action-icon-stop {
+ background-position: -14px -14px;
+}
+
+.host-panel button:disabled .action-icon-restart {
+ background-position: -28px -14px;
+}
+
+.host-panel button:disabled .action-icon-download {
+ background-position: -42px -14px;
+}
+
+.host-panel button:disabled .action-icon-connect {
+ background-position: -56px -14px;
+}
+
+.host-panel button:disabled .action-icon-add {
+ background-position: -70px -14px;
+}
+
+.host-panel button:disabled .action-icon-edit {
+ background-position: -84px -14px;
+}
+
+.host-panel button:disabled .action-icon-remove {
+ background-position: -98px -14px;
+}
+
+.host-panel .info-container {
+ padding-top: 16px;
+ width: 890px;
+}
+
+.host-panel .section-header {
+ background: #EEE;
+ border-radius: 5px;
+ cursor: pointer;
+ line-height: 2em;
+ margin: 1em 0 1em;
+ padding-left: 6px;
+}
+
+.host-panel .section-header:hover {
+ background: #06f;
+ color: white;
+}
+
+.host-panel .section-content {
+ padding-left: 1em;
+}
+
+.host-panel .section-header .arrow {
+ border-color: transparent;
+ border-style: solid;
+ display: inline-block;
+ margin-right: 6px;
+ width: 0;
+}
+
+.host-panel .section-header[aria-expanded="true"] .arrow {
+ border-top-color: black;
+ border-width: 8px 4px 0;
+ border-bottom: none;
+}
+
+.host-panel .section-header[aria-expanded="true"]:hover .arrow {
+ border-top-color: white;
+}
+
+.host-panel .section-header[aria-expanded="false"] .arrow {
+ border-left-color: black;
+ border-right: none;
+ border-width: 4px 0 4px 8px;
+}
+
+.host-panel .section-header[aria-expanded="false"]:hover .arrow {
+ border-left-color: white;
+}
+
+.host-panel .section-row {
+ line-height: 1.6em;
+ margin-bottom: 1em;
+}
+
+.host-panel .section-label {
+ width: 100px;
+}
+
+#frequency-textbox {
+ width: 20px;
+}
+
+#container-chart-cpu,
+#container-chart-memory,
+#container-chart-disk-io,
+#container-chart-network-io {
+ border: 1px solid white;
+ box-shadow: 2px 2px 2px gray, 2px -2px 2px gray, -2px -2px 2px gray, -2px
+ 2px 2px gray;
+ height: 100px;
+ width: 500px;
+}
+
+#container-chart-disk-io .disk-write,
+#container-chart-network-io .network-sent {
+ stroke: #f80;
+}
+
+/* Debug Report */
+.cell-text-wrapper {
+ margin-left: 10px;
+}
+
+.host-panel #available-reports-grid {
+ border-color: #ddd;
+ height: 400px;
+ width: 850px;
+}
+
+.host-panel select#available-reports-list {
+ width: 300px;
+}
+
+.host-panel select#available-reports-list option {
+ margin: .2em 1em;
+}
+
+.debug-report-name,
+.debug-report-time {
+ width: 424px;
+}
+
+#id-debug-img {
+ background: url(../images/theme-default/kimchi-loading15x15.gif) 12px
+ center no-repeat;
+ padding-left: 23px;
+}
+
+/* End of Debug Report */
+
+/* Software Updates */
+.host-panel #software-updates-grid {
+ border-color: #ddd;
+ height: 300px;
+ width: 850px;
+}
+
+.software-update-name,
+.software-update-repos {
+ width: 224px;
+}
+
+.software-update-version,
+.software-update-arch {
+ width: 200px;
+}
+
+.host-panel #software-updates-progress-textarea {
+ border: 1px solid #ddd;
+ box-sizing: border-box;
+ height: 100px;
+ padding: .2em .5em;
+ resize: vertical;
+ width: 852px;
+}
+/* End of Software Updates */
+
+/* Repository */
+.host-panel #repositories-grid {
+ border-color: #ddd;
+ height: 200px;
+ width: 850px;
+}
+
+.host-panel #repositories-grid .repository-id {
+ width: 120px;
+}
+
+.host-panel #repositories-grid .repository-name {
+ width: 640px;
+}
+
+.host-panel #repositories-grid .repository-enabled {
+ width: 88px;
+}
+
+.host-panel #repositories-grid .repository-baseurl.deb {
+ width: 400px;
+}
+
+.host-panel #repositories-grid .repository-enabled.deb {
+ width: 100px;
+}
+
+.host-panel #repositories-grid .repository-gpgcheck.deb {
+ width: 150px;
+}
+/* End of Repository */
diff --git a/plugins/gingerbase/ui/css/theme-default/report-add.css b/plugins/gingerbase/ui/css/theme-default/report-add.css
new file mode 100644
index 0000000..8020182
--- /dev/null
+++ b/plugins/gingerbase/ui/css/theme-default/report-add.css
@@ -0,0 +1,37 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#report-add-window {
+ height: 300px;
+ width: 400px;
+}
+
+#report-add-window .field {
+ font-size: 12px;
+}
+
+#report-name-textbox {
+ margin: 0;
+ width: 100%;
+}
+
+.info-add-debug-report {
+ font-size: 12px;
+ color: #999999;
+ font-weight: lighter;
+ font-family: 'Helvetica Neue', Helvetica, Arial;
+}
\ No newline at end of file
diff --git a/plugins/gingerbase/ui/css/theme-default/report-rename.css b/plugins/gingerbase/ui/css/theme-default/report-rename.css
new file mode 100644
index 0000000..2fb2698
--- /dev/null
+++ b/plugins/gingerbase/ui/css/theme-default/report-rename.css
@@ -0,0 +1,39 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#report-rename-window {
+ height: 300px;
+ width: 400px;
+}
+
+#report-rename-window .field {
+ font-size: 12px;
+}
+
+#report-name-textbox {
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ margin: 0;
+ width: 100%;
+}
+
+.info-debug-report-rename {
+ font-size: 12px;
+ color: #999999;
+ font-weight: lighter;
+ font-family: 'Helvetica Neue', Helvetica, Arial;
+}
diff --git a/plugins/gingerbase/ui/css/theme-default/repository-add.css b/plugins/gingerbase/ui/css/theme-default/repository-add.css
new file mode 100644
index 0000000..4344569
--- /dev/null
+++ b/plugins/gingerbase/ui/css/theme-default/repository-add.css
@@ -0,0 +1,42 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#repository-add-window {
+ height: 500px;
+ width: 1000px;
+}
+
+#repository-add-window span.required {
+ color: red;
+ padding-left: 5px;
+ vertical-align: top;
+}
+
+#repository-add-window .textbox-wrapper input[type="text"] {
+ box-sizing: border-box;
+ width: 100%;
+}
+
+#repository-add-window .textbox-wrapper label {
+ vertical-align: middle;
+}
+
+#isMirrorLabel {
+ font-size: 14px;
+ font-weight: lighter;
+ font-family: 'Helvetica Neue', Helvetica, Arial;
+}
\ No newline at end of file
diff --git a/plugins/gingerbase/ui/css/theme-default/repository-edit.css b/plugins/gingerbase/ui/css/theme-default/repository-edit.css
new file mode 100644
index 0000000..383a7fe
--- /dev/null
+++ b/plugins/gingerbase/ui/css/theme-default/repository-edit.css
@@ -0,0 +1,88 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.yum div#repository-edit-window {
+ height: 680px;
+ width: 1000px;
+}
+
+.deb div#repository-edit-window {
+ height: 480px;
+ width: 1000px;
+}
+
+
+.repository-edit-fieldset {
+ float: left;
+ padding: 0 30px;
+ width: 95%;
+}
+
+.repository-edit-wrapper-label, .repository-edit-wrapper-controls {
+ display: inline-block;
+ height: 30px;
+ line-height: 30px;
+ font-size: 14px;
+ vertical-align: top;
+}
+
+.repository-edit-wrapper-label {
+ margin-top: 10px;
+ width: 150px;
+}
+
+.repository-edit-wrapper-controls label {
+ vertical-align: middle;
+}
+
+.repository-edit-wrapper-controls {
+ width: 100%;
+}
+
+.repository-edit-wrapper-controls input[type="text"] {
+ font-size: 16px;
+ height: 30px;
+ line-height: 30px;
+ padding: 0 10px;
+ width: 100%;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ border: 1px solid #CCCCCC;
+}
+
+
+.repository-edit-wrapper-controls input[type="text"][readonly] {
+ color: #bbb;
+ background-color: #fafafa;
+}
+
+
+.repository-edit-wrapper-controls input[type="text"][disabled] {
+ color: #bbb;
+ background-color: #fafafa;
+ cursor: not-allowed;
+}
+
+
+.deb .yum{
+ display: none;
+}
+
+
+.yum .deb{
+ display: none;
+}
diff --git a/plugins/gingerbase/ui/js/src/gingerbase.host.js b/plugins/gingerbase/ui/js/src/gingerbase.host.js
new file mode 100644
index 0000000..ab02333
--- /dev/null
+++ b/plugins/gingerbase/ui/js/src/gingerbase.host.js
@@ -0,0 +1,858 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-2014
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+kimchi.host={};
+
+kimchi.host_main = function() {
+ var expand = function(header, toExpand) {
+ var controlledNode = $(header).attr('aria-controls');
+ $('#' + controlledNode)[toExpand ? 'removeClass' : 'addClass']('hidden');
+ $(header).attr('aria-expanded', toExpand ? 'true' : 'false');
+ };
+
+ var repositoriesGrid = null;
+ var initRepositoriesGrid = function(repo_type) {
+ var gridFields=[];
+ if (repo_type == "yum") {
+ gridFields=[{
+ name: 'repo_id',
+ label: i18n['KCHREPO6004M'],
+ 'class': 'repository-id'
+ }, {
+ name: 'config[repo_name]',
+ label: i18n['KCHREPO6005M'],
+ 'class': 'repository-name'
+ }, {
+ name: 'enabled',
+ label: i18n['KCHREPO6009M'],
+ 'class': 'repository-enabled'
+ }];
+ }
+ else if (repo_type == "deb") {
+ gridFields=[{
+ name: 'baseurl',
+ label: i18n['KCHREPO6006M'],
+ makeTitle: true,
+ 'class': 'repository-baseurl deb'
+ }, {
+ name: 'enabled',
+ label: i18n['KCHREPO6009M'],
+ 'class': 'repository-enabled deb'
+ }, {
+ name: 'config[dist]',
+ label: "dist",
+ 'class': 'repository-gpgcheck deb'
+ }, {
+ name: 'config[comps]',
+ label: "comps",
+ 'class': 'repository-gpgcheck deb'
+ }];
+ }
+ else {
+ gridFields=[{
+ name: 'repo_id',
+ label: i18n['KCHREPO6004M'],
+ 'class': 'repository-id'
+ }, {
+ name: 'enabled',
+ label: i18n['KCHREPO6009M'],
+ 'class': 'repository-enabled'
+ }, {
+ name: 'baseurl',
+ label: i18n['KCHREPO6006M'],
+ makeTitle: true,
+ 'class': 'repository-baseurl'
+ }];
+ }
+ repositoriesGrid = new kimchi.widget.Grid({
+ container: 'repositories-grid-container',
+ id: 'repositories-grid',
+ title: i18n['KCHREPO6003M'],
+ toolbarButtons: [{
+ id: 'repositories-grid-add-button',
+ label: i18n['KCHREPO6012M'],
+ onClick: function(event) {
+ wok.window.open({url:'plugins/kimchi/repository-add.html',
+ class: repo_type});
+ }
+ }, {
+ id: 'repositories-grid-enable-button',
+ label: i18n['KCHREPO6016M'],
+ disabled: true,
+ onClick: function(event) {
+ var repository = repositoriesGrid.getSelected();
+ if(!repository) {
+ return;
+ }
+ var name = repository['repo_id'];
+ var enable = !repository['enabled'];
+ $(this).prop('disabled', true);
+ kimchi.enableRepository(name, enable, function() {
+ wok.topic('kimchi/repositoryUpdated').publish();
+ });
+ }
+ }, {
+ id: 'repositories-grid-edit-button',
+ label: i18n['KCHREPO6013M'],
+ disabled: true,
+ onClick: function(event) {
+ var repository = repositoriesGrid.getSelected();
+ if(!repository) {
+ return;
+ }
+ kimchi.selectedRepository = repository['repo_id'];
+ wok.window.open({url:'plugins/kimchi/repository-edit.html',
+ class: repo_type});
+ }
+ }, {
+ id: 'repositories-grid-remove-button',
+ label: i18n['KCHREPO6014M'],
+ disabled: true,
+ onClick: function(event) {
+ var repository = repositoriesGrid.getSelected();
+ if(!repository) {
+ return;
+ }
+
+ var settings = {
+ title : i18n['KCHREPO6001M'],
+ content : i18n['KCHREPO6002M'],
+ confirm : i18n['KCHAPI6004M'],
+ cancel : i18n['KCHAPI6003M']
+ };
+
+ wok.confirm(settings, function() {
+ kimchi.deleteRepository(
+ repository['repo_id'],
+ function(result) {
+ wok.topic('kimchi/repositoryDeleted').publish(result);
+ }, function(error) {
+ }
+ );
+ });
+ }
+ }],
+ onRowSelected: function(row) {
+ var repository = repositoriesGrid.getSelected();
+ if(!repository) {
+ return;
+ }
+ $('#repositories-grid-remove-button').prop('disabled', false);
+ $('#repositories-grid-edit-button').prop('disabled', false);
+ var enabled = repository['enabled'];
+ $('#repositories-grid-enable-button')
+ .text(i18n[enabled ? 'KCHREPO6017M' : 'KCHREPO6016M'])
+ .prop('disabled', false);
+ },
+ frozenFields: [],
+ fields: gridFields,
+ data: listRepositories
+ });
+ };
+
+ var listRepositories = function(gridCallback) {
+ kimchi.listRepositories(function(repositories) {
+ if($.isFunction(gridCallback)) {
+ gridCallback(repositories);
+ }
+ else {
+ if(repositoriesGrid) {
+ repositoriesGrid.setData(repositories);
+ }
+ else {
+ initRepositoriesGrid();
+ repositoriesGrid.setData(repositories);
+ }
+ }
+ },
+ function(error) {
+ var message = error && error['responseJSON'] && error['responseJSON']['reason'];
+
+ if($.isFunction(gridCallback)) {
+ gridCallback([]);
+ }
+ repositoriesGrid &&
+ repositoriesGrid.showMessage(message || i18n['KCHUPD6008M']);
+ });
+
+ $('#repositories-grid-remove-button').prop('disabled', true);
+ $('#repositories-grid-edit-button').prop('disabled', true);
+ $('#repositories-grid-enable-button').prop('disabled', true);
+ };
+
+ var softwareUpdatesGridID = 'software-updates-grid';
+ var softwareUpdatesGrid = null;
+ var progressAreaID = 'software-updates-progress-textarea';
+ var reloadProgressArea = function(result) {
+ var progressArea = $('#' + progressAreaID)[0];
+ $(progressArea).text(result['message']);
+ var scrollTop = $(progressArea).prop('scrollHeight');
+ $(progressArea).prop('scrollTop', scrollTop);
+ };
+
+ var initSoftwareUpdatesGrid = function(softwareUpdates) {
+ softwareUpdatesGrid = new kimchi.widget.Grid({
+ container: 'software-updates-grid-container',
+ id: softwareUpdatesGridID,
+ title: i18n['KCHUPD6001M'],
+ rowSelection: 'disabled',
+ toolbarButtons: [{
+ id: softwareUpdatesGridID + '-update-button',
+ label: i18n['KCHUPD6006M'],
+ disabled: true,
+ onClick: function(event) {
+ var updateButton = $(this);
+ var progressArea = $('#' + progressAreaID)[0];
+ $('#software-updates-progress-container').removeClass('hidden');
+ $(progressArea).text('');
+ !wok.isElementInViewport(progressArea) &&
+ progressArea.scrollIntoView();
+ $(updateButton).text(i18n['KCHUPD6007M']).prop('disabled', true);
+
+ kimchi.updateSoftware(function(result) {
+ reloadProgressArea(result);
+ $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
+ wok.topic('kimchi/softwareUpdated').publish({
+ result: result
+ });
+ }, function(error) {
+ var message = error && error['responseJSON'] && error['responseJSON']['reason'];
+ wok.message.error(message || i18n['KCHUPD6009M']);
+ $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
+ }, reloadProgressArea);
+ }
+ }],
+ frozenFields: [],
+ fields: [{
+ name: 'package_name',
+ label: i18n['KCHUPD6002M'],
+ 'class': 'software-update-name'
+ }, {
+ name: 'version',
+ label: i18n['KCHUPD6003M'],
+ 'class': 'software-update-version'
+ }, {
+ name: 'arch',
+ label: i18n['KCHUPD6004M'],
+ 'class': 'software-update-arch'
+ }, {
+ name: 'repository',
+ label: i18n['KCHUPD6005M'],
+ 'class': 'software-update-repos'
+ }],
+ data: listSoftwareUpdates
+ });
+ };
+
+ var listSoftwareUpdates = function(gridCallback) {
+ kimchi.listSoftwareUpdates(function(softwareUpdates) {
+ if($.isFunction(gridCallback)) {
+ gridCallback(softwareUpdates);
+ }
+ else {
+ if(softwareUpdatesGrid) {
+ softwareUpdatesGrid.setData(softwareUpdates);
+ }
+ else {
+ initSoftwareUpdatesGrid(softwareUpdates);
+ }
+ }
+
+ var updateButton = $('#' + softwareUpdatesGridID + '-update-button');
+ $(updateButton).prop('disabled', softwareUpdates.length === 0);
+ }, function(error) {
+ var message = error && error['responseJSON'] && error['responseJSON']['reason'];
+ if($.isFunction(gridCallback)) {
+ gridCallback([]);
+ }
+ softwareUpdatesGrid &&
+ softwareUpdatesGrid.showMessage(message || i18n['KCHUPD6008M']);
+ });
+ };
+
+ var reportGridID = 'available-reports-grid';
+ var reportGrid = null;
+ var enableReportButtons = function(toEnable) {
+ var buttonID = '#{grid}-{btn}-button';
+ $.each(['rename', 'remove', 'download'], function(i, n) {
+ $(wok.substitute(buttonID, {
+ grid: reportGridID,
+ btn: n
+ })).prop('disabled', !toEnable);
+ });
+ };
+ var initReportGrid = function(reports) {
+ reportGrid = new kimchi.widget.Grid({
+ container: 'available-reports-grid-container',
+ id: reportGridID,
+ title: i18n['KCHDR6002M'],
+ toolbarButtons: [{
+ id: reportGridID + '-generate-button',
+ label: i18n['KCHDR6006M'],
+ onClick: function(event) {
+ wok.window.open('plugins/kimchi/report-add.html');
+ }
+ }, {
+ id: reportGridID + '-rename-button',
+ label: i18n['KCHDR6008M'],
+ disabled: true,
+ onClick: function(event) {
+ var report = reportGrid.getSelected();
+ if(!report) {
+ return;
+ }
+
+ kimchi.selectedReport = report['name'];
+ wok.window.open('plugins/kimchi/report-rename.html');
+ }
+ }, {
+ id: reportGridID + '-remove-button',
+ label: i18n['KCHDR6009M'],
+ disabled: true,
+ onClick: function(event) {
+ var report = reportGrid.getSelected();
+ if(!report) {
+ return;
+ }
+
+ var settings = {
+ title : i18n['KCHAPI6004M'],
+ content : i18n['KCHDR6001M'],
+ confirm : i18n['KCHAPI6002M'],
+ cancel : i18n['KCHAPI6003M']
+ };
+
+ wok.confirm(settings, function() {
+ kimchi.deleteReport({
+ name: report['name']
+ }, function(result) {
+ listDebugReports();
+ }, function(error) {
+ wok.message.error(error.responseJSON.reason);
+ });
+ });
+ }
+ }, {
+ id: reportGridID + '-download-button',
+ label: i18n['KCHDR6010M'],
+ disabled: true,
+ onClick: function(event) {
+ var report = reportGrid.getSelected();
+ if(!report) {
+ return;
+ }
+
+ kimchi.downloadReport({
+ file: report['uri']
+ });
+ }
+ }],
+ onRowSelected: function(row) {
+ var report = reportGrid.getSelected();
+ // Only enable report buttons if the selected line is not a
+ // pending report
+ if (report['time'] == i18n['KCHDR6007M']) {
+ var gridElement = $('#'+ reportGridID);
+ var row = $('tr:contains(' + report['name'] + ')', gridElement);
+ enableReportButtons(false);
+ row.attr('class', '');
+ }
+ else {
+ enableReportButtons(true);
+ }
+ },
+ frozenFields: [],
+ fields: [{
+ name: 'name',
+ label: i18n['KCHDR6003M'],
+ 'class': 'debug-report-name'
+ }, {
+ name: 'time',
+ label: i18n['KCHDR6005M'],
+ 'class': 'debug-report-time'
+ }],
+ data: reports
+ });
+ };
+
+ var getPendingReports = function() {
+ var reports = []
+ var filter = 'status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/debugreports/*')
+
+ kimchi.getTasksByFilter(filter, function(tasks) {
+ for(var i = 0; i < tasks.length; i++) {
+ reportName = tasks[i].target_uri.replace(/^\/plugins\/kimchi\/debugreports\//, '') || i18n['KCHDR6012M'];
+ reports.push({'name': reportName, 'time': i18n['KCHDR6007M']})
+
+ if(kimchi.trackingTasks.indexOf(tasks[i].id) >= 0) {
+ continue;
+ }
+
+ kimchi.trackTask(tasks[i].id, function(result) {
+ wok.topic('kimchi/debugReportAdded').publish();
+ }, function(result) {
+ // Error message from Async Task status
+ if (result['message']) {
+ var errText = result['message'];
+ }
+ // Error message from standard kimchi exception
+ else {
+ var errText = result['responseJSON']['reason'];
+ }
+ result && wok.message.error(errText);
+ wok.topic('kimchi/debugReportAdded').publish();
+ }, null);
+ }
+ }, null, true);
+
+ return reports;
+ };
+
+ var listDebugReports = function() {
+ kimchi.listReports(function(reports) {
+ pendingReports = getPendingReports();
+ allReports = pendingReports.concat(reports);
+ $('#debug-report-section').removeClass('hidden');
+
+ // Row selection will be cleared so disable buttons here
+ enableReportButtons(false);
+
+ if(reportGrid) {
+ reportGrid.setData(allReports);
+ }
+ else {
+ initReportGrid(allReports);
+ }
+
+ // Set id-debug-img to pending reports
+ // It will display a loading icon
+ var gridElement = $('#' + reportGridID);
+ $.each($('td:contains(' + i18n['KCHDR6007M'] + ')', gridElement), function(index, row) {
+ $(row).parent().addClass('no-hover');
+ $(row).attr('id', 'id-debug-img');
+ });
+ }, function(error) {
+ if(error['status'] == 403) {
+ $('#debug-report-section').addClass('hidden');
+ return;
+ }
+ $('#debug-report-section').removeClass('hidden');
+ });
+ };
+
+ var shutdownButtonID = '#host-button-shutdown';
+ var restartButtonID = '#host-button-restart';
+ var shutdownHost = function(params) {
+ var settings = {
+ title : i18n['KCHAPI6004M'],
+ content : i18n['KCHHOST6008M'],
+ confirm : i18n['KCHAPI6002M'],
+ cancel : i18n['KCHAPI6003M']
+ };
+
+ wok.confirm(settings, function() {
+ kimchi.shutdown(params);
+ $(shutdownButtonID).prop('disabled', true);
+ $(restartButtonID).prop('disabled', true);
+ // Check if there is any VM is running.
+ kimchi.listVMs(function(vms) {
+ for(var i = 0; i < vms.length; i++) {
+ if(vms[i]['state'] === 'running') {
+ wok.message.error.code('KCHHOST6001E');
+ $(shutdownButtonID).prop('disabled', false);
+ $(restartButtonID).prop('disabled', false);
+ return;
+ }
+ }
+
+ });
+ }, function() {
+ });
+ };
+
+ var initPage = function() {
+ $('#host-info-container .section-header').each(function(i, header) {
+ $('<span class="arrow"></span>').prependTo(header);
+ var toExpand = $(header).attr('aria-expanded') !== 'false';
+ expand(header, toExpand);
+ });
+
+ $('#host-info-container').on('click', '.section-header', function(event) {
+ var toExpand = $(this).attr('aria-expanded') === 'false';
+ expand(this, toExpand);
+ });
+
+ $('#host-button-shutdown').on('click', function(event) {
+ shutdownHost(null);
+ });
+
+ $('#host-button-restart').on('click', function(event) {
+ shutdownHost({
+ reboot: true
+ });
+ });
+
+ var setupUI = function() {
+ if (kimchi.capabilities == undefined) {
+ setTimeout(setupUI, 2000);
+ return;
+ }
+
+ if((kimchi.capabilities['repo_mngt_tool']) && (kimchi.capabilities['repo_mngt_tool']!="None")) {
+ initRepositoriesGrid(kimchi.capabilities['repo_mngt_tool']);
+ $('#repositories-section').switchClass('hidden', kimchi.capabilities['repo_mngt_tool']);
+ wok.topic('kimchi/repositoryAdded')
+ .subscribe(listRepositories);
+ wok.topic('kimchi/repositoryUpdated')
+ .subscribe(listRepositories);
+ wok.topic('kimchi/repositoryDeleted')
+ .subscribe(listRepositories);
+ }
+
+ if(kimchi.capabilities['update_tool']) {
+ $('#software-update-section').removeClass('hidden');
+ initSoftwareUpdatesGrid();
+ wok.topic('kimchi/softwareUpdated')
+ .subscribe(listSoftwareUpdates);
+ $('#software-updates-progress-container').accordion({
+ collapsible: true
+ });
+ }
+
+ if(kimchi.capabilities['system_report_tool']) {
+ listDebugReports();
+ wok.topic('kimchi/debugReportAdded')
+ .subscribe(listDebugReports);
+ wok.topic('kimchi/debugReportRenamed')
+ .subscribe(listDebugReports);
+ }
+ };
+ setupUI();
+ };
+
+ kimchi.getHost(function(data) {
+ var htmlTmpl = $('#host-tmpl').html();
+ data['logo'] = data['logo'] || '';
+ data['memory'] = wok.formatMeasurement(data['memory'], {
+ fixed: 2
+ });
+ var templated = wok.substitute(htmlTmpl, data);
+ $('#host-content-container').html(templated);
+
+ initPage();
+ initTracker();
+ });
+
+ var StatsMgr = function() {
+ var statsArray = {
+ cpu: {
+ u: {
+ type: 'percent',
+ legend: i18n['KCHHOST6002M'],
+ points: []
+ }
+ },
+ memory: {
+ u: {
+ type: 'value',
+ base: 2,
+ fixed: 2,
+ legend: i18n['KCHHOST6003M'],
+ points: []
+ }
+ },
+ diskIO: {
+ r: {
+ type: 'value',
+ base: 2,
+ fixed: 2,
+ unit: 'B/s',
+ legend: i18n['KCHHOST6004M'],
+ points: []
+ },
+ w: {
+ type: 'value',
+ base: 2,
+ fixed: 2,
+ unit: 'B/s',
+ legend: i18n['KCHHOST6005M'],
+ 'class': 'disk-write',
+ points: []
+ }
+ },
+ networkIO: {
+ r: {
+ type: 'value',
+ base: 2,
+ fixed: 2,
+ unit: 'B/s',
+ legend: i18n['KCHHOST6006M'],
+ points: []
+ },
+ s: {
+ type: 'value',
+ base: 2,
+ fixed: 2,
+ unit: 'B/s',
+ legend: i18n['KCHHOST6007M'],
+ 'class': 'network-sent',
+ points: []
+ }
+ }
+ };
+ var SIZE = 20;
+ var cursor = SIZE;
+
+ var add = function(stats) {
+ for(var key in stats) {
+ var item = stats[key];
+ for(var metrics in item) {
+ var value = item[metrics]['v'];
+ var max = item[metrics]['max'];
+ var unifiedMetrics = statsArray[key][metrics];
+ var ps = unifiedMetrics['points'];
+ if(!Array.isArray(value)){
+ ps.push(value);
+ if(ps.length > SIZE + 1) {
+ ps.shift();
+ }
+ }
+ else{
+ ps=ps.concat(value);
+ ps.splice(0, ps.length-SIZE-1);
+ unifiedMetrics['points']=ps;
+ }
+ if(max !== undefined) {
+ unifiedMetrics['max'] = max;
+ }
+ else {
+ if(unifiedMetrics['type'] !== 'value') {
+ continue;
+ }
+ max = -Infinity;
+ $.each(ps, function(i, value) {
+ if(value > max) {
+ max = value;
+ }
+ });
+ if(max === 0) {
+ ++max;
+ }
+ max *= 1.1;
+ unifiedMetrics['max'] = max;
+ }
+ }
+ }
+ cursor++;
+ };
+
+ var get = function(which) {
+ var stats = statsArray[which];
+ var lines = [];
+ for(var k in stats) {
+ var obj = stats[k];
+ var line = {
+ type: obj['type'],
+ base: obj['base'],
+ unit: obj['unit'],
+ fixed: obj['fixed'],
+ legend: obj['legend']
+ };
+ if(obj['max']) {
+ line['max'] = obj['max'];
+ }
+ if(obj['class']) {
+ line['class'] = obj['class'];
+ }
+ var ps = obj['points'];
+ var numStats = ps.length;
+ var unifiedPoints = [];
+ $.each(ps, function(i, value) {
+ unifiedPoints.push({
+ x: cursor - numStats + i,
+ y: value
+ });
+ });
+ line['points'] = unifiedPoints;
+ lines.push(line);
+ }
+ return lines;
+ };
+
+ return {
+ add: add,
+ get: get
+ };
+ };
+
+ var Tracker = function(charts) {
+ var charts = charts;
+ var timer = null;
+ var statsPool = new StatsMgr();
+ var setCharts = function(newCharts) {
+ charts = newCharts;
+ for(var key in charts) {
+ var chart = charts[key];
+ chart.updateUI(statsPool.get(key));
+ }
+ };
+
+ var self = this;
+
+ var UnifyStats = function(stats) {
+ var result= {
+ cpu: {
+ u: {
+ v: stats['cpu_utilization']
+ }
+ },
+ memory: {
+ u: {
+ }
+ },
+ diskIO: {
+ r: {
+ v: stats['disk_read_rate']
+ },
+ w: {
+ v: stats['disk_write_rate']
+ }
+ },
+ networkIO: {
+ r: {
+ v: stats['net_recv_rate']
+ },
+ s: {
+ v: stats['net_sent_rate']
+ }
+ }
+ };
+ if(Array.isArray(stats['memory'])){
+ result.memory.u['v']=[];
+ result.memory.u['max']=-Infinity;
+ for(var i=0;i<stats['memory'].length;i++){
+ result.memory.u['v'].push(stats['memory'][i]['avail']);
+ result.memory.u['max']=Math.max(result.memory.u['max'],stats['memory'][i]['total']);
+ }
+ }
+ else {
+ result.memory.u['v']=stats['memory']['avail'],
+ result.memory.u['max']=stats['memory']['total']
+ }
+ return(result);
+ };
+
+
+ var statsCallback = function(stats) {
+ var unifiedStats = UnifyStats(stats);
+ statsPool.add(unifiedStats);
+ for(var key in charts) {
+ var chart = charts[key];
+ chart.updateUI(statsPool.get(key));
+ }
+ timer = setTimeout(function() {
+ continueTrack();
+ }, 1000);
+ };
+
+ var track = function() {
+ kimchi.getHostStatsHistory(statsCallback,
+ function() {
+ continueTrack();
+ });
+ };
+
+ var continueTrack = function() {
+ kimchi.getHostStats(statsCallback,
+ function() {
+ continueTrack();
+ });
+ };
+
+ var destroy = function() {
+ timer && clearTimeout(timer);
+ timer = null;
+ };
+
+ return {
+ setCharts: setCharts,
+ start: track,
+ stop: destroy
+ };
+ };
+
+ var initTracker = function() {
+ // TODO: Extend tabs with onUnload event to unregister timers.
+ if(kimchi.hostTimer) {
+ kimchi.hostTimer.stop();
+ delete kimchi.hostTimer;
+ }
+
+ var trackedCharts = {
+ cpu: new kimchi.widget.LineChart({
+ id: 'chart-cpu',
+ node: 'container-chart-cpu',
+ type: 'percent'
+ }),
+ memory: new kimchi.widget.LineChart({
+ id: 'chart-memory',
+ node: 'container-chart-memory',
+ type: 'value'
+ }),
+ diskIO: new kimchi.widget.LineChart({
+ id: 'chart-disk-io',
+ node: 'container-chart-disk-io',
+ type: 'value'
+ }),
+ networkIO: new kimchi.widget.LineChart({
+ id: 'chart-network-io',
+ node: 'container-chart-network-io',
+ type: 'value'
+ })
+ };
+
+ if(kimchi.hostTimer) {
+ kimchi.hostTimer.setCharts(trackedCharts);
+ }
+ else {
+ kimchi.hostTimer = new Tracker(trackedCharts);
+ kimchi.hostTimer.start();
+ }
+ };
+
+ $('#host-root-container').on('remove', function() {
+ if(kimchi.hostTimer) {
+ kimchi.hostTimer.stop();
+ delete kimchi.hostTimer;
+ }
+
+ repositoriesGrid && repositoriesGrid.destroy();
+ wok.topic('kimchi/repositoryAdded')
+ .unsubscribe(listRepositories);
+ wok.topic('kimchi/repositoryUpdated')
+ .unsubscribe(listRepositories);
+ wok.topic('kimchi/repositoryDeleted')
+ .unsubscribe(listRepositories);
+
+ softwareUpdatesGrid && softwareUpdatesGrid.destroy();
+ wok.topic('kimchi/softwareUpdated').unsubscribe(listSoftwareUpdates);
+
+ reportGrid && reportGrid.destroy();
+ wok.topic('kimchi/debugReportAdded').unsubscribe(listDebugReports);
+ wok.topic('kimchi/debugReportRenamed').unsubscribe(listDebugReports);
+ });
+};
diff --git a/plugins/gingerbase/ui/js/src/gingerbase.report_add_main.js b/plugins/gingerbase/ui/js/src/gingerbase.report_add_main.js
new file mode 100644
index 0000000..5f098d3
--- /dev/null
+++ b/plugins/gingerbase/ui/js/src/gingerbase.report_add_main.js
@@ -0,0 +1,72 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-2014
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+kimchi.report_add_main = function() {
+ var reportGridID = 'available-reports-grid';
+ var addReportForm = $('#form-report-add');
+ var submitButton = $('#button-report-add');
+ var nameTextbox = $('input[name="name"]', addReportForm);
+ nameTextbox.select();
+
+ var submitForm = function(event) {
+ if(submitButton.prop('disabled')) {
+ return false;
+ }
+ var reportName = nameTextbox.val();
+ var validator = RegExp("^[_A-Za-z0-9-]*$");
+ if (!validator.test(reportName)) {
+ wok.message.error.code('KCHDR6011M');
+ return false;
+ }
+ var formData = addReportForm.serializeObject();
+ var taskAccepted = false;
+ var onTaskAccepted = function() {
+ if(taskAccepted) {
+ return;
+ }
+ taskAccepted = true;
+ wok.window.close();
+ wok.topic('kimchi/debugReportAdded').publish();
+ };
+
+ kimchi.createReport(formData, function(result) {
+ onTaskAccepted();
+ wok.topic('kimchi/debugReportAdded').publish();
+ }, function(result) {
+ // Error message from Async Task status
+ if (result['message']) {
+ var errText = result['message'];
+ }
+ // Error message from standard kimchi exception
+ else {
+ var errText = result['responseJSON']['reason'];
+ }
+ result && wok.message.error(errText);
+
+ taskAccepted &&
+ $('.grid-body-view table tr:first-child',
+ '#' + reportGridID).remove();
+ submitButton.prop('disabled', false);
+ nameTextbox.select();
+ }, onTaskAccepted);
+
+ event.preventDefault();
+ };
+
+ addReportForm.on('submit', submitForm);
+ submitButton.on('click', submitForm);
+};
diff --git a/plugins/gingerbase/ui/js/src/gingerbase.report_rename_main.js b/plugins/gingerbase/ui/js/src/gingerbase.report_rename_main.js
new file mode 100644
index 0000000..1bdb8d9
--- /dev/null
+++ b/plugins/gingerbase/ui/js/src/gingerbase.report_rename_main.js
@@ -0,0 +1,66 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+kimchi.report_rename_main = function() {
+ var renameReportForm = $('#form-report-rename');
+ var submitButton = $('#button-report-rename');
+ var nameTextbox = $('input[name="name"]', renameReportForm);
+ var submitForm = function(event) {
+ if(submitButton.prop('disabled')) {
+ return false;
+ }
+ var reportName = nameTextbox.val();
+
+ // if the user hasn't changed the report's name,
+ // nothing should be done.
+ if (reportName == kimchi.selectedReport) {
+ wok.message.error.code('KCHDR6013M');
+ return false;
+ }
+
+ var validator = RegExp("^[A-Za-z0-9-]*$");
+ if (!validator.test(reportName)) {
+ wok.message.error.code('KCHDR6011M');
+ return false;
+ }
+ var formData = renameReportForm.serializeObject();
+ submitButton.prop('disabled', true);
+ nameTextbox.prop('disabled', true);
+ kimchi.renameReport(kimchi.selectedReport, formData, function(result) {
+ submitButton.prop('disabled', false);
+ nameTextbox.prop('disabled', false);
+ wok.window.close();
+ wok.topic('kimchi/debugReportRenamed').publish({
+ result: result
+ });
+ }, function(result) {
+ var errText = result &&
+ result['responseJSON'] &&
+ result['responseJSON']['reason'];
+ wok.message.error(errText);
+ submitButton.prop('disabled', false);
+ nameTextbox.prop('disabled', false).focus();
+ });
+
+ event.preventDefault();
+ };
+
+ renameReportForm.on('submit', submitForm);
+ submitButton.on('click', submitForm);
+
+ nameTextbox.val(kimchi.selectedReport).select();
+};
diff --git a/plugins/gingerbase/ui/js/src/gingerbase.repository_add_main.js b/plugins/gingerbase/ui/js/src/gingerbase.repository_add_main.js
new file mode 100644
index 0000000..656306b
--- /dev/null
+++ b/plugins/gingerbase/ui/js/src/gingerbase.repository_add_main.js
@@ -0,0 +1,96 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+kimchi.repository_add_main = function() {
+
+ var addForm = $('#form-repository-add');
+ var addButton = $('#button-repository-add');
+
+ var validateField = function(event) {
+ var valid=($(this).val()!=='');
+ $(addButton).prop('disabled', !valid);
+ return(valid);
+ };
+
+ var validateForm = function(event) {
+ var valid=false;
+ addForm.find('input.required').each( function() {
+ valid=($(this).val()!=='');
+ return(!valid);
+ });
+ return(valid);
+ }
+
+ addForm.find('input.required').on('input propertychange', validateField);
+
+ var weedObject = function(obj) {
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ if((typeof(obj[key])==="object") && !Array.isArray(obj[key])) {
+ weedObject(obj[key]);
+ }
+ else if(obj[key] == '') {
+ delete obj[key];
+ }
+ }
+ }
+ }
+
+ var addRepository = function(event) {
+ var valid = validateForm();
+ if(!valid) {
+ return false;
+ }
+
+ var formData = $(addForm).serializeObject();
+
+ if (formData && formData.isMirror!=undefined) {
+ formData.isMirror=(String(formData.isMirror).toLowerCase() === 'true');
+ }
+ if(formData.isMirror) {
+ if(formData.config==undefined) {
+ formData.config=new Object();
+ }
+ formData.config.mirrorlist=formData.baseurl;
+ delete formData.baseurl;
+ delete formData.isMirror;
+ }
+ weedObject(formData);
+ if(formData.config && formData.config.comps) {
+ formData.config.comps=formData.config.comps.split(/[,\s]/);
+ for(var i=0; i>formData.config.comps.length; i++) {
+ formData.config.comps[i]=formData.config.comps[i].trim();
+ }
+ for (var j=formData.config.comps.indexOf(""); j!=-1; j=formData.config.comps.indexOf("")) {
+ formData.config.comps.splice(j, 1);
+ }
+ }
+
+ kimchi.createRepository(formData, function() {
+ wok.topic('kimchi/repositoryAdded').publish();
+ wok.window.close();
+ }, function(jqXHR, textStatus, errorThrown) {
+ var reason = jqXHR &&
+ jqXHR['responseJSON'] &&
+ jqXHR['responseJSON']['reason'];
+ wok.message.error(reason);
+ });
+ return false;
+ };
+
+ $(addForm).on('submit', addRepository);
+};
diff --git a/plugins/gingerbase/ui/js/src/gingerbase.repository_edit_main.js b/plugins/gingerbase/ui/js/src/gingerbase.repository_edit_main.js
new file mode 100644
index 0000000..5bfc51e
--- /dev/null
+++ b/plugins/gingerbase/ui/js/src/gingerbase.repository_edit_main.js
@@ -0,0 +1,74 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+kimchi.repository_edit_main = function() {
+
+ var editForm = $('#form-repository-edit');
+
+ var saveButton = $('#repository-edit-button-save');
+
+ if(kimchi.capabilities['repo_mngt_tool']=="yum") {
+ editForm.find('input.deb').prop('disabled', true);
+ }
+ else if(kimchi.capabilities['repo_mngt_tool']=="deb") {
+ editForm.find('input.yum').prop('disabled', true);
+ }
+
+ kimchi.retrieveRepository(kimchi.selectedRepository, function(repository) {
+ editForm.fillWithObject(repository);
+
+ $('input', editForm).on('input propertychange', function(event) {
+ if($(this).val() !== '') {
+ $(saveButton).prop('disabled', false);
+ }
+ });
+ });
+
+
+ var editRepository = function(event) {
+ var formData = $(editForm).serializeObject();
+
+ if (formData && formData.config) {
+ formData.config.gpgcheck=(String(formData.config.gpgcheck).toLowerCase() === 'true');
+ }
+
+ if(formData.config && formData.config.comps) {
+ formData.config.comps=formData.config.comps.split(/[,\s]/);
+ for(var i=0; i>formData.config.comps.length; i++) {
+ formData.config.comps[i]=formData.config.comps[i].trim();
+ }
+ for (var j=formData.config.comps.indexOf(""); j!=-1; j=formData.config.comps.indexOf("")) {
+ formData.config.comps.splice(j, 1);
+ }
+ }
+
+ kimchi.updateRepository(kimchi.selectedRepository, formData, function() {
+ wok.topic('kimchi/repositoryUpdated').publish();
+ wok.window.close();
+ }, function(jqXHR, textStatus, errorThrown) {
+ var reason = jqXHR &&
+ jqXHR['responseJSON'] &&
+ jqXHR['responseJSON']['reason'];
+ wok.message.error(reason);
+ });
+
+ return false;
+ };
+
+ $(editForm).on('submit', editRepository);
+ $(saveButton).on('click', editRepository);
+};
diff --git a/plugins/gingerbase/ui/pages/help/de_DE/host.dita b/plugins/gingerbase/ui/pages/help/de_DE/host.dita
new file mode 100644
index 0000000..33a40e3
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/de_DE/host.dita
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="de-de">
+<title>Host</title>
+<shortdesc>Die Seite <wintitle>Host</wintitle> zeigt Informationen zum Hostsystem an und ermöglicht Ihnen, den Host herunterzufahren, erneut zu starten und eine Verbindung zu ihm herzustellen.</shortdesc>
+<csbody>
+<p>Sie können die folgenden Aktionen am Host durchführen:<ul>
+<li>Wählen Sie <uicontrol>Herunterfahren</uicontrol> aus, um das Hostsystem herunterzufahren.</li>
+<li>Wählen Sie <uicontrol>Erneut starten</uicontrol> aus, um das Hostsystem erneut zu starten.</li>
+<li>Wählen Sie <uicontrol>Verbinden</uicontrol> aus, um eine VNC-Verbindung zum Hostsystem herzustellen, wenn noch keine Verbindung besteht.</li>
+</ul></p>
+<p>Klicken Sie auf die folgenden Abschnitte, um Informationen zum Host anzuzeigen:<dl>
+<dlentry>
+<dt>Basisinformationen</dt>
+<dd>Dieser Abschnitt zeigt die Verteilung, die Version und den Codenamen des Hostbetriebssystems sowie den Prozessortyp und die Speicherkapazität in GB an.</dd>
+</dlentry><dlentry>
+<dt>Systemstatistik</dt>
+<dd>Dieser Abschnitt zeigt mithilfe von Grafiken Statistiken für CPU, Speicher, Platten-E/A und Netz-E/A für den Host an. Wählen Sie <uicontrol>Daten werden nach dem Verlassen dieser Seite gesammelt</uicontrol> aus, um mit der Sammlung von Daten fortzufahren, wenn die Host-Registerkarte nicht angezeigt wird.</dd>
+</dlentry><dlentry>
+<dt>Software-Updates</dt>
+<dd>Dieser Abschnitt zeigt Informationen für alle Pakete an, bei denen Aktualisierungen verfügbar sind, einschließlich Paketname, Version, Architektur und Repository. Sie können alle aufgelisteten Pakete aktualisieren, indem Sie <uicontrol>Alle aktualisieren</uicontrol> auswählen. Sie können nicht einzelne Pakete zur Aktualisierung auswählen.</dd>
+</dlentry><dlentry>
+<dt>Repositorys</dt>
+<dd>Dieser Abschnitt zeigt Repositorys an, die dem Hostsystem zugeordnet sind. Sie können Repositorys hinzufügen, aktivieren, bearbeiten oder entfernen. Beim Hinzufügen wird ein Repository dem Hostsystem zugeordnet. Das Aktivieren eines Repositorys dagegen ermöglicht dem Host den Zugriff auf das Repository. Wenn Ihr System Red Hat Enterprise
+Linux oder Fedora ist, können Sie <filepath>yum</filepath>-Repositorys hinzufügen.
+Wenn Ihr System Ubuntu oder Debian ist, fügen Sie <filepath>deb</filepath>-Repositorys hinzu.<p>Wenn Sie mit yum-Repositorys arbeiten, können Sie eine GPG-Prüfung hinzufügen, um sicherzustellen, dass ein Paket aus diesem Repository nicht beschädigt wurde.
+Wählen Sie ein Repository und dann <uicontrol>Bearbeiten</uicontrol> aus. Wählen Sie <uicontrol>Ja</uicontrol> aus, um die GPG-Prüfung zu aktivieren, und geben Sie dann ein URL zur GPG-Schlüsseldatei für das Repository ein.</p></dd>
+</dlentry><dlentry>
+<dt>Debugberichte</dt>
+<dd>Dieser Abschnitt zeigt Debugberichte, einschließlich Name und Dateipfad, an.
+Sie haben die Möglichkeit, einen neuen Bericht zu erstellen oder einen bestehenden Bericht umzubenennen, zu entfernen oder herunterzuladen.<p>Der Debugbericht wird während des Befehls <cmdname>sosreport</cmdname> generiert. Er ist verfügbar für Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>-, Fedora-
+und Ubuntu-Verteilungen. Der Befehl generiert eine .tar-Datei, die Konfigurations- und Diagnoseinformationen enthält, wie zum Beispiel Kernelversion, geladene Module sowie System- und Servicekonfigurationdateien.
+Der Befehl führt zudem externe Programme aus, um weitere Informationen zu sammeln, und speichert diese Ausgabe im resultierenden Archiv.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/en_US/host.dita b/plugins/gingerbase/ui/pages/help/en_US/host.dita
new file mode 100644
index 0000000..0dcb670
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/en_US/host.dita
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+<?Pub Sty _display FontColor="red"?>
+<?Pub Inc?>
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="en-us">
+<title>Host</title>
+<shortdesc>The <wintitle>Host</wintitle> page shows information about
+the host system, and allows you to shut down, restart, and connect
+to the host.</shortdesc>
+<csbody>
+<p>You can perform the following actions on the host:<ul>
+<li>Select <uicontrol>Shut down</uicontrol> to shut down the host
+system.</li>
+<li>Select <uicontrol>Restart</uicontrol> to restart the host system.</li>
+<li>Select <uicontrol>Connect</uicontrol> to open a VNC connection
+to the host system, if it is not already connected.</li>
+</ul></p>
+<p>Click the following sections to display information about the host:<dl>
+<dlentry>
+<dt>Basic information</dt>
+<dd>This section displays the host operating system distribution,
+version, and code name, as well as the processor type, the number of
+online CPUs and amount of memory in GB.</dd>
+</dlentry><dlentry>
+<dt>System statistics</dt>
+<dd>This section displays graphs to show statistics for CPU, memory,
+disk I/O, and network I/O for the host. Select <uicontrol>Collecting
+data after leaving this page</uicontrol> to continue collecting data
+when the host tab is out of view.</dd>
+</dlentry><dlentry>
+<dt>Software Updates</dt>
+<dd>This section displays information for all of the packages that
+have updates available, including package name, version, architecture,
+and repository. You can update all of the packages listed by selecting <uicontrol>Update
+All</uicontrol>. You cannot select individual packages for updates.</dd>
+</dlentry><dlentry>
+<dt>Repositories</dt>
+<dd>This section displays repositories that are associated with the
+host system. You can add, enable, edit, or remove repositories. Adding
+a repository associates it with the host system while enabling a repository
+allows the host to access it. If your system is Red Hat Enterprise
+Linux or Fedora, you can add <filepath>yum</filepath> repositories.
+If your system is Ubuntu or Debian, then add <filepath>deb</filepath> repositories.<p>If
+you are working with yum repositories, you can add a GPG check to
+verify that a package from this repository have not been corrupted.
+Select a repository and then <uicontrol>Edit</uicontrol>. Select <uicontrol>Yes</uicontrol> to
+enable GPG Check and then enter a URL to the GPG key file for the
+repository.</p><?Pub Caret 156?></dd>
+</dlentry><dlentry>
+<dt>Debug reports</dt>
+<dd>This section displays debug reports, including name and file path.
+You can select from options to generate a new report, or rename, remove,
+or download an existing report.<p>The debug report is generated using
+the <cmdname>sosreport</cmdname> command. It is available for Red
+Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora,
+and Ubuntu distributions. The command generates a .tar file that contains
+configuration and diagnostic information, such as the running kernel
+version, loaded modules, and system and service configuration files.
+The command also runs external programs to collect further information
+and stores this output in the resulting archive.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+<?Pub *0000003492?>
diff --git a/plugins/gingerbase/ui/pages/help/es_ES/host.dita b/plugins/gingerbase/ui/pages/help/es_ES/host.dita
new file mode 100644
index 0000000..7734244
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/es_ES/host.dita
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="es-es">
+<title>Host</title>
+<shortdesc>La página <wintitle>Host</wintitle> muestra información sobre el sistema host y le permite concluir, reiniciar y conectar con el sistema principal.</shortdesc>
+<csbody>
+<p>Puede realizar las acciones siguientes en el host:<ul>
+<li>Seleccione <uicontrol>Concluir</uicontrol> para concluir el sistema host.</li>
+<li>Seleccione <uicontrol>Reiniciar</uicontrol> para reiniciar el sistema host.</li>
+<li>Seleccione <uicontrol>Conectar</uicontrol> para abrir una conexión VNC al sistema host, si no está conectado aún.</li>
+</ul></p>
+<p>Pulse en las secciones siguientes para visualizar información acerca del host:<dl>
+<dlentry>
+<dt>Información básica</dt>
+<dd>Esta sección muestra la distribución del sistema operativo de host, la versión y el nombre de código, así como el tipo de procesador y la cantidad de memoria en GB.</dd>
+</dlentry><dlentry>
+<dt>Estadísticas del sistema</dt>
+<dd>Esta sección muestra gráficos para mostrar estadísticas para CPU, memoria, E/S de disco y E/S de red para el host. Seleccione <uicontrol>Recoger datos después de salir de esta página</uicontrol> para continuar la recogida de datos cuando la pestaña principal ya no está a la vista.</dd>
+</dlentry><dlentry>
+<dt>Actualizaciones de software</dt>
+<dd>En esta sección se muestra información para todos los paquetes que tienen actualizaciones disponibles, incluido el nombre de paquete, versión, arquitectura y repositorio. Puede actualizar todos los paquetes listados seleccionando <uicontrol>Actualizar todo</uicontrol>. No puede seleccionar paquetes individuales para las actualizaciones.</dd>
+</dlentry><dlentry>
+<dt>Repositorios</dt>
+<dd>En esta sección se muestran los repositorios que están asociados con el sistema host. Puede añadir, habilitar, editar o eliminar repositorios. Añadir un repositorio lo asocia con el sistema host mientras que habilitar un repositorio permite que el host acceda a él. Si el sistema es Red Hat Enterprise
+Linux o Fedora, puede añadir repositorios <filepath>yum</filepath>.
+Si el sistema es Ubuntu o Debian, añada repositorios <filepath>deb</filepath>.<p>Si está trabajando con repositorios yum, puede añadir una comprobación GPG para verificar que un paquete de este repositorio no ha resultado dañado.
+Seleccione un repositorio y, a continuación, <uicontrol>Editar</uicontrol>. Seleccione <uicontrol>Sí</uicontrol> para habilitar la comprobación GPG y, a continuación, especifique un URL al archivo de claves GPG para el repositorio.</p></dd>
+</dlentry><dlentry>
+<dt>Informes de depuración</dt>
+<dd>En esta sección se muestran informes de depuración, incluido el nombre y la ruta de archivo.
+Puede seleccionar entre opciones para generar un informe nuevo, o bien redenominar, eliminar o descargar un informe existente.<p>El informe de depuración se genera utilizando el mandato <cmdname>sosreport</cmdname>. Está disponible para distribuciones de Red
+Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora y Ubuntu. El mandato genera un archivo .tar que contiene la información de configuración y de diagnóstico, como la versión de kernel en ejecución, los módulos de carga y los archivos de configuración del sistema y servicio.
+El mandato también ejecuta programas externos para recopilar información adicional y almacena esta salida en el archivo resultante.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/fr_FR/host.dita b/plugins/gingerbase/ui/pages/help/fr_FR/host.dita
new file mode 100644
index 0000000..f4c330b
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/fr_FR/host.dita
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="fr-fr">
+<title>Hôte</title>
+<shortdesc>La page <wintitle>Hôte</wintitle> affiche des informations
+sur le système hôte et vous permet d'arrêter, de redémarrer et de vous
+connecter à l'hôte.</shortdesc>
+<csbody>
+<p>Vous pouvez effectuer les actions suivantes sur l'hôte :<ul>
+<li>Sélectionnez <uicontrol>Arrêter</uicontrol> pour arrêter le système hôte.</li>
+<li>Sélectionnez <uicontrol>Redémarrer</uicontrol> pour redémarrer le système hôte.</li>
+<li>Sélectionnez <uicontrol>Connexion</uicontrol> pour ouvrir une connexion VNC
+au système hôte, si celui-ci n'est pas déjà connecté.</li>
+</ul></p>
+<p>Cliquez sur les sections suivantes pour afficher des informations sur l'hôte :<dl>
+<dlentry>
+<dt>Informations de base</dt>
+<dd>Cette section affiche la distribution, la version et le nom de code
+du système d'exploitation hôte, ainsi que le type de processeur et la quantité
+de mémoire en Go.</dd>
+</dlentry><dlentry>
+<dt>Statistiques système</dt>
+<dd>Cette section affiche les graphiques des statistiques pour l'UC, mémoire, ainsi que
+les E-S disque et E-S réseau pour l'hôte. Sélectionnez <uicontrol>Collecte des données une fois la page quittée</uicontrol>
+pour continuer la collecte de données lorsque l'onglet hôte n'est plus visible.</dd>
+</dlentry><dlentry>
+<dt>Mises à jour logicielles</dt>
+<dd>Cette section affiche des informations pour tous les modules qui
+disposent de mises à jour disponibles, y compris le nom de module, la version, l'architecture
+et le référentiel. Vous pouvez mettre à jour toutes les modules répertoriés en sélectionnant <uicontrol>Tout
+mettre à jour</uicontrol>. Vous ne pouvez pas sélectionner des modules individuels pour les mises à jour.</dd>
+</dlentry><dlentry>
+<dt>Référentiels</dt>
+<dd>Cette section affiche les référentiels associés au système hôte. Vous pouvez ajouter, activer, éditer ou retirer des référentiels. L'ajout d'un référentiel associe celui-ci au système hôte,
+tandis que l'activation d'un référentiel permet à l'hôte d'y accéder. Si votre système est Red Hat Enterprise Linux ou Fedora,
+vous pouvez ajouter des référentiels <filepath>yum</filepath>.
+Si votre système est de type Ubuntu ou Debian, ajoutez des référentiels
+<filepath>deb</filepath>.<p>Si vous travaillez avec des référentiels yum, vous pouvez ajouter un contrôle GPG
+afin de vérifier qu'un module provenant de ce référentiel n'a pas été endommagé.
+Sélectionnez un référentiel puis cliquez sur <uicontrol>Editer</uicontrol>. Sélectionnez <uicontrol>Oui</uicontrol> pour activer le contrôle GPG,
+puis entrez une URL pour le fichier de clés GPG du référentiel.</p></dd>
+</dlentry><dlentry>
+<dt>Rapports de débogage</dt>
+<dd>Cette section affiche les rapports de débogage, y compris le nom et le chemin du fichier.
+Vous pouvez faire un choix parmi les options afin de générer un nouveau rapport, ou renommer, supprimer,
+ou télécharger un rapport existant.<p>Le rapport de débogage est généré à
+l'aide de la commande <cmdname>sosreport</cmdname>. Cette option est disponible pour les distributions
+Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora et Ubuntu. La commande génère un fichier .tar contenant la configuration et des informations de diagnostic,
+telles que la version du noyau d'exécution, les modules chargés, ainsi que les fichiers de configuration
+du système et de la maintenance.
+La commande exécute également des programmes externes pour collecter des informations
+supplémentaires et stocke cette sortie dans l'archive résultante.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/it_IT/host.dita b/plugins/gingerbase/ui/pages/help/it_IT/host.dita
new file mode 100644
index 0000000..63d3367
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/it_IT/host.dita
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="it-it">
+<title>Host</title>
+<shortdesc>La pagina <wintitle>Host</wintitle> visualizza le informazioni sul sistema host e consente di arrestarlo, riavviarlo e connettersi ad esso.</shortdesc>
+<csbody>
+<p>È possibile effettuare le seguenti operazioni sull'host:<ul>
+<li>Selezionare <uicontrol>Arresta</uicontrol> per arrestare il sistema host.</li>
+<li>Selezionare <uicontrol>Riavvia</uicontrol> per riavviare il sistema host.</li>
+<li>Selezionare <uicontrol>Connetti</uicontrol> per aprire una connessione VNC al sistema host, se non è già connesso.</li>
+</ul></p>
+<p>Fare clic sulle seguenti sezioni per visualizzare le informazioni sull'host:<dl>
+<dlentry>
+<dt>Informazioni di base</dt>
+<dd>Questa sezione visualizza il nome codice, la versione e la distribuzione del sistema operativo, come pure il tipo di processore e la quantità di memoria in GB.</dd>
+</dlentry><dlentry>
+<dt>Statistiche di sistema</dt>
+<dd>Questa sezione visualizza i grafici che mostrano le statistiche per la CPU, la memoria, l'I/O disco e di rete per l'host. Selezionare <uicontrol>Raccolta dati all'uscita dalla pagina</uicontrol> per continuare la raccolta dei dati quando la scheda host non è più visibile.</dd>
+</dlentry><dlentry>
+<dt>Aggiornamenti del software</dt>
+<dd>Questa sezione visualizza le informazioni per tutti i pacchetti per cui sono disponibili gli aggiornamenti, incluso il nome, la versione, l'architettura e il repository del pacchetto. È possibile aggiornare tutti i pacchetti elencati, selezionando <uicontrol>Aggiorna tutto</uicontrol>. Non è possibile selezionare singoli pacchetti per gli aggiornamenti.</dd>
+</dlentry><dlentry>
+<dt>Repository</dt>
+<dd>Questa sezione visualizza i repository associati al sistema host. È possibile aggiungere, abilitare, modificare o rimuovere i repository. L'aggiunta di un repository lo associa al sistema host, mentre l'abilitazione di un repository
+consente all'host di accedervi. Se il sistema è Red Hat Enterprise
+Linux o Fedora, è possibile aggiungere i repository <filepath>yum</filepath>.
+Se il sistema è Ubuntu o Debian, aggiungere i repository <filepath>deb</filepath>.<p>Se si stanno utilizzando i repository yum, è possibile aggiungere un controllo GPG per verificare che un pacchetto da questo repository non sia stato corrotto.
+Selezionare un repository, quindi <uicontrol>Modifica</uicontrol>. Selezionare <uicontrol>Sì</uicontrol> per abilitare il controllo GPG, quindi immettere un URL al file di chiavi GPG per il
+repository.</p></dd>
+</dlentry><dlentry>
+<dt>Report di debug</dt>
+<dd>Questa sezione visualizza i report di debug, incluso il nome e il percorso file.
+Le opzioni disponibili consentono di generare un nuovo report oppure ridenominare, rimuovere o scaricare un report esistente.<p>Il report di debug viene generato utilizzando il comando <cmdname>sosreport</cmdname>. È disponibile per le distribuzioni Red
+Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora e Ubuntu. Il comando genera un file .tar che contiene informazioni di diagnostica e configurazione, come la versione del kernel in esecuzione, i moduli caricati e i file di configurazione del servizio e del sistema.
+Il comando esegue anche programmi esterni per raccogliere ulteriori informazioni e memorizza l'output nell'archivio risultante.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/ja_JP/host.dita b/plugins/gingerbase/ui/pages/help/ja_JP/host.dita
new file mode 100644
index 0000000..3a0141c
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/ja_JP/host.dita
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="ja-jp">
+<title>ホスト</title>
+<shortdesc><wintitle>「ホスト」</wintitle>ページには、ホスト・システムに関する情報が表示されます。ここで、ホストをシャットダウン、再始動、またホストに接続することができます。
+</shortdesc>
+<csbody>
+<p>以下のアクションをホストに対して実行できます。
+<ul>
+<li>ホスト・システムをシャットダウンするには<uicontrol>「シャットダウン」</uicontrol>を選択します。
+</li>
+<li>ホスト・システムを再始動するには<uicontrol>「再始動」</uicontrol>を選択します。
+</li>
+<li>ホスト・システムへの VNC 接続を (まだ接続されていない場合に) オープンするには、<uicontrol>「接続」</uicontrol>を選択します。
+</li>
+</ul></p>
+<p>ホストに関する情報を表示するには、以下の選択項目をクリックしてください。
+<dl>
+<dlentry>
+<dt>基本情報</dt>
+<dd>このセクションには、ホスト・オペレーティング・システムのディストリビューション、バージョン、およびコード名、さらにプロセッサー・タイプとメモリーの量 (GB 単位) が表示されます。
+</dd>
+</dlentry><dlentry>
+<dt>システム統計情報</dt>
+<dd>このセクションには、ホストの CPU、メモリー、ディスク入出力、およびネットワーク入出力の統計情報を表すグラフが表示されます。
+ホスト・タブを閉じたときにデータの収集を続行するには、<uicontrol>「このページを閉じた後、データを収集する」</uicontrol>を選択してください。
+</dd>
+</dlentry><dlentry>
+<dt>ソフトウェア更新</dt>
+<dd>このセクションには、更新が用意されているパッケージすべての情報
+(パッケージ名、バージョン、アーキテクチャー、リポジトリーなど) が表示されます。
+<uicontrol>「すべて更新」</uicontrol>を選択すると、リストされているパッケージすべてを更新できます。
+更新する対象として個別のパッケージを選択することはできません。
+</dd>
+</dlentry><dlentry>
+<dt>リポジトリー</dt>
+<dd>このセクションには、ホスト・システムに関連付けられているリポジトリーが表示されます。
+リポジトリーを追加する、有効にする、編集する、または削除することができます。
+リポジトリーを追加すると、そのリポジトリーがホスト・システムに関連付けられ、リポジトリーを有効にすると、そのリポジトリーにホストがアクセスできるようになります。
+システムが Red Hat Enterprise Linux または Fedora であれば、<filepath>yum</filepath> リポジトリーを追加できます。
+システムが Ubuntu または Debian であれば、<filepath>deb</filepath> リポジトリーを追加してください。
+<p>yum リポジトリーを操作している場合、そのリポジトリーに入っているパッケージが壊れていないことを確認するため、GPG チェックを追加できます。
+リポジトリーを選択し、<uicontrol>「編集」</uicontrol>をクリックしてください。
+<uicontrol>「はい」</uicontrol>を選択して GPG チェックを有効にしてから、そのリポジトリーの GPG 鍵ファイルの URL を入力してください。
+</p></dd>
+</dlentry><dlentry>
+<dt>デバッグ・レポート</dt>
+<dd>このセクションには、デバッグ・レポート (名前やファイル・パスなど) が表示されます。
+新しいレポートを生成、既存のレポートを名前変更、削除、またはダウンロードするためのオプションを選択できます。
+<p>デバッグ・レポートは、<cmdname>sosreport</cmdname> コマンドで生成されます。
+これは、Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>、Fedora、および Ubuntu ディストリビューションに用意されています。
+このコマンドは、構成および診断情報 (稼働中のカーネルのバージョン、ロードされているモジュール、システムおよびサービス構成ファイルなど) が入った .tar ファイルを生成します。
+このコマンドはまた、外部プログラムを実行して情報をさらに収集し、その出力を結果のアーカイブに保管します。
+</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 227 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 1 -->
diff --git a/plugins/gingerbase/ui/pages/help/ko_KR/host.dita b/plugins/gingerbase/ui/pages/help/ko_KR/host.dita
new file mode 100644
index 0000000..ee4a9c3
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/ko_KR/host.dita
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="ko-kr">
+<title>호스트</title>
+<shortdesc><wintitle>호스트</wintitle> 페이지에는 호스트 시스템에 대한 정보가 표시되며 이 페이지를 사용하여 호스트를 종료 및 다시 시작하거나 호스트에 연결할 수 있습니다.</shortdesc>
+<csbody>
+<p>호스트에 대해 다음 조치를 수행할 수 있습니다.<ul>
+<li>호스트 시스템을 종료하려면 <uicontrol>시스템 종료</uicontrol>를 선택합니다.</li>
+<li>호스트 시스템을 다시 시작하려면 <uicontrol>다시 시작</uicontrol>을 선택합니다.</li>
+<li>이미 연결되어 있지 않은 경우, 호스트 시스템에 대한 VNC 연결을 시작하려면 <uicontrol>연결</uicontrol>을 선택합니다.</li>
+</ul></p>
+<p>호스트에 대한 정보를 표시하려면 다음 섹션을 클릭하십시오.<dl>
+<dlentry>
+<dt>기본 정보</dt>
+<dd>이 섹션에는 호스트 운영 체제 배포, 버전, 코드 이름, 프로세서 유형, 메모리 용량(GB) 등이 표시됩니다.</dd>
+</dlentry><dlentry>
+<dt>시스템 통계</dt>
+<dd>이 섹션에는 호스트의 CPU, 메모리, 디스크 I/O, 네트워크 I/O에 대한 통계를 표시하는 그래프가 표시됩니다. 호스트 탭을 떠났을 때 데이터 수집을 계속하려면 <uicontrol>이 페이지를 떠난 후에 데이터 수집</uicontrol>을 선택합니다.</dd>
+</dlentry><dlentry>
+<dt>소프트웨어 업데이트</dt>
+<dd>이 섹션에는 패키지 이름, 버전, 아키텍처, 저장소를 비롯하여 사용 가능한 업데이트가 있는 모든 패키지에 대한 정보가 표시됩니다. <uicontrol>모두 업데이트</uicontrol>를 선택하여 나열된 모든 패키지를 업데이트할 수 있습니다. 업데이트에 대해 개별 패키지를 선택할 수는 없습니다.</dd>
+</dlentry><dlentry>
+<dt>저장소</dt>
+<dd>이 섹션에는 호스트 시스템과 연관된 저장소가 표시됩니다. 저장소를 추가하거나, 사용으로 설정하거나, 편집하거나, 제거할 수 있습니다. 저장소를 추가하면 저장소가 호스트 시스템과 연관되며, 저장소를 사용으로 설정하면 호스트가 저장소에 액세스할 수 있습니다. 해당 시스템이 Red Hat Enterprise Linux 또는 Fedora인 경우, <filepath>yum</filepath> 저장소를 추가할 수 있습니다.
+해당 시스템이 Ubuntu 또는 Debian인 경우, <filepath>deb</filepath> 저장소를 추가하십시오.<p>yum 저장소로 작업하는 경우, GPG 검사를 추가하여 이 저장소의 패키지가 손상되지 않았는지 확인할 수 있습니다.
+저장소를 선택한 후 <uicontrol>편집</uicontrol>을 선택하십시오. <uicontrol>예</uicontrol>를 선택하여 GPG 검사를 사용으로 설정한 후 저장소에 대한 GPG 키 파일의 URL을 입력하십시오.</p></dd>
+</dlentry><dlentry>
+<dt>디버그 보고서</dt>
+<dd>이 섹션에는 이름 및 파일 경로를 포함한 디버그 보고서가 표시됩니다.
+새 보고서 생성, 기존 보고서 이름 바꾸기, 제거, 다운로드 등의 옵션 중에서 선택할 수 있습니다.<p>디버그 보고서는 <cmdname>sosreport</cmdname> 명령을 사용하여 생성됩니다. 이는 Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora 및 Ubuntu 배포에서 사용 가능합니다. 이 명령은 구성 및 진단 정보(예: 실행 중인 커널 버전, 로드된 모듈, 시스템 및 서비스 구성 파일)를 포함하는 .tar 파일을 생성합니다.
+또한 이 명령은 외부 프로그램을 실행하여 추가 정보를 수집하고 결과 아카이브에 이 출력을 저장합니다.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/pt_BR/host.dita b/plugins/gingerbase/ui/pages/help/pt_BR/host.dita
new file mode 100644
index 0000000..88f7eb2
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/pt_BR/host.dita
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="pt-br">
+<title>Host</title>
+<shortdesc>A página <wintitle>Host</wintitle> mostra informações sobre
+o sistema host e permite encerrar, reiniciar e conectar
+ao host.</shortdesc>
+<csbody>
+<p>É possível executar as ações a segur no host:<ul>
+<li>Selecione <uicontrol>Encerrar</uicontrol> para encerrar o sistema
+host.</li>
+<li>Selecione <uicontrol>Reiniciar</uicontrol> para reiniciar o sistema host.</li>
+<li>Selecione <uicontrol>Conectar</uicontrol> para abrir uma conexão VNC
+para o sistema host, se ele já não estiver conectado.</li>
+</ul></p>
+<p>Clique nas seções a seguir para exibir informações sobre o host:<dl>
+<dlentry>
+<dt>Informações básicas</dt>
+<dd>Esta seção exibe a distribuição do sistema operacional do host,
+a versão e o nome do código, bem como o tipo de processador e quantia de
+memória em GB.</dd>
+</dlentry><dlentry>
+<dt>Estatísticas do sistema</dt>
+<dd>Esta seção exibe gráficos para mostrar estatísticas para CPU, memória,
+E/S de disco e E/S de rede para o host. Selecione <uicontrol>Coletando
+dados depois de sair desta página</uicontrol> para continuar a coletar dados
+quando a guia do host estiver fora de visualização.</dd>
+</dlentry><dlentry>
+<dt>Atualizações de software</dt>
+<dd>Esta seção exibe informações de todos os pacotes que
+possuem atualizações disponíveis, incluindo nome do pacote, versão, arquitetura
+e repositório. É possível atualizar todos os pacotes listados selecionando <uicontrol>Atualizar
+todos</uicontrol>. Não é possível selecionar pacotes individuais para atualizações.</dd>
+</dlentry><dlentry>
+<dt>Repositórios</dt>
+<dd>Esta seção exibe repositórios que estão associados ao
+sistema host. É possível incluir, ativar, editar ou remover repositórios. Incluir
+um repositório o associa com o sistema host enquanto ativar um repositório
+permite que o host o acesse. Se o seu sistema for Red Hat Enterprise
+Linux ou Fedora, será possível incluir repositórios <filepath>yum</filepath>.
+Se o seu sistema for Ubuntu ou Debian, inclua repositórios <filepath>deb</filepath>.<p>Se
+você estiver trabalhando com repositórios yum, será possível incluir uma verificação de GPG para
+verificar se um pacote desse repositório não foi corrompido.
+Selecione um repositório e, em seguida, <uicontrol>Editar</uicontrol>. Selecione <uicontrol>Sim</uicontrol> para
+ativar a Verificação de GPG e, em seguida, insira uma URL no arquivo-chave de GPG para o
+repositório.</p></dd>
+</dlentry><dlentry>
+<dt>Relatórios de depuração</dt>
+<dd>Esta seção exibe relatórios de depuração, incluindo nome e caminho do arquivo.
+É possível selecionar a partir das opções para gerar um novo relatório ou renomear, remover
+ou fazer o download de um relatório existente.<p>O relatório de depuração é gerado usando
+o comando <cmdname>sosreport</cmdname>. Ele está disponível para distribuições
+Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora
+e Ubuntu. O comando gera um arquivo .tar que contém
+informações de configuração e de diagnóstico, como versão do kernel
+em execução, módulos carregados e arquivos de configuração de sistema e de serviço.
+O comando também executa programas externos para coletar informações adicionais
+e armazena essa saída no archive resultante.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/ru_RU/host.dita b/plugins/gingerbase/ui/pages/help/ru_RU/host.dita
new file mode 100644
index 0000000..fb72c21
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/ru_RU/host.dita
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="ru-ru">
+<title>Хост</title>
+<shortdesc>Страница <wintitle>Хост</wintitle> показывает информацию о системе хоста и позволяет останавливать хост, перезапускать хост и подключаться к нему.</shortdesc>
+<csbody>
+<p>На хосте можно выполнять следующие действия:<ul>
+<li><uicontrol>Завершить работу</uicontrol> - остановить систему хоста.</li>
+<li><uicontrol>Перезапустить</uicontrol> - перезапустить систему хоста.</li>
+<li><uicontrol>Подключиться</uicontrol> - открыть соединение VNC с системой хоста, если оно еще не установлено.</li>
+</ul></p>
+<p>Щелкните на следующих разделах для просмотра информации о хосте:<dl>
+<dlentry>
+<dt>Базовая информация</dt>
+<dd>В этом разделе показывается вариант операционной системы, его версия и кодовое имя, а также тип процессора и объем памяти в ГБ.</dd>
+</dlentry><dlentry>
+<dt>Системная статистика</dt>
+<dd>В этом разделе показываются графики, отражающие статистическую информацию о процессоре, памяти, дисковом вводе-выводе и сетевом вводе-выводе для хоста. Выберите <uicontrol>Сбор данных после закрытия этой страницы</uicontrol>, чтобы сбор данных продолжался после закрытия вкладки Хост.</dd>
+</dlentry><dlentry>
+<dt>Обновления программного обеспечения</dt>
+<dd>В этом разделе показывается информация обо всех пакетах, для которых доступны обновления, включая имя пакета, версию, архитектуру и хранилище. Можно обновить все пакеты в списке щелчком на <uicontrol>Обновить все</uicontrol>. Отдельные пакеты для обновления выбрать нельзя.</dd>
+</dlentry><dlentry>
+<dt>Хранилища</dt>
+<dd>В этом разделе показываются хранилища, связанные с системой хоста. Хранилища можно добавлять, активировать, изменять и удалять. При добавлении хранилище связывается с системой хоста, при активации хранилище становится доступным для хоста. Если система - Red Hat Enterprise Linux или Fedora, можно добавить хранилища <filepath>yum</filepath>.
+Если система - Ubuntu или Debian, добавьте хранилища <filepath>deb</filepath>.<p>При работе с хранилищами yum можно добавить проверку GPG для проверки целостности пакетов из данного хранилища.
+Выберите хранилище и щелкните на <uicontrol>Изменить</uicontrol>. Выберите <uicontrol>Да</uicontrol>, чтобы включить проверку GPG, и введите URL файла ключей GPG для хранилища.</p></dd>
+</dlentry><dlentry>
+<dt>Отладочные отчеты</dt>
+<dd>В этом разделе показываются отладочные отчеты, включая имя и путь.
+Доступны команды для создания, переименования, удаления и загрузки отчетов.<p>Отладочный отчет создается командой <cmdname>sosreport</cmdname>. Он доступен для Red
+Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora и Ubuntu. Команда создает файл .tar с конфигурационной и диагностической информацией, такой как версия ядра, загруженные модули и файлы конфигурации системы и служб.
+Команда также выполняет внешние программы для сбора дополнительной информации и сохраняет их вывод в результирующем архиве.</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/zh_CN/host.dita b/plugins/gingerbase/ui/pages/help/zh_CN/host.dita
new file mode 100644
index 0000000..78a89c3
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/zh_CN/host.dita
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="zh-cn">
+<title>主机</title>
+<shortdesc>“<wintitle>主机</wintitle>”页面显示有关主机系统的信息,并且允许您对主机进行关闭、启动和连接。</shortdesc>
+<csbody>
+<p>可对主机执行以下操作:<ul>
+<li>选择<uicontrol>关闭</uicontrol>以关闭主机系统。</li>
+<li>选择<uicontrol>重新启动</uicontrol>以重新启动主机系统。</li>
+<li>选择<uicontrol>连接</uicontrol>以打开与主机系统的 VNC 连接(如果尚未连接)。</li>
+</ul></p>
+<p>单击以下部分以显示有关主机的信息:<dl>
+<dlentry>
+<dt>基本信息</dt>
+<dd>本部分显示主机操作系统分发版、版本和代码名称以及处理器类型和内存量(以 GB 计)。</dd>
+</dlentry><dlentry>
+<dt>系统统计信息</dt>
+<dd>本部分显示图形,以显示主机有关 CPU、内存、磁盘 I/O 和网络 I/O 的统计信息。选择<uicontrol>离开此页面之后收集数据</uicontrol>以继续在主机选项卡不在视图中时收集数据。</dd>
+</dlentry><dlentry>
+<dt>软件更新</dt>
+<dd>本部分显示有更新可用的所有软件包的信息,其中包括软件包名称、版本、体系结构和存储库。可通过选择<uicontrol>全部更新</uicontrol>来更新所列示的所有软件包。不能针对更新选择各个软件包。</dd>
+</dlentry><dlentry>
+<dt>存储库</dt>
+<dd>本部分显示与主机系统关联的存储库。您可以添加、启用、编辑或除去存储库。当启用存储库会允许主机对其进行访问时,添加存储库会将其与主机系统关联。如果您的系统为 Red Hat Enterprise Linux 或 Fedora,那么可添加 <filepath>yum</filepath> 存储库。如果您的系统为 Ubuntu 或 Debian,那么请添加 <filepath>deb</filepath> 存储库。<p>如果要处理 Yum 存储库,您可以添加 GPG 检查以验证此存储库中的软件包是否已损坏。选择一个存储库,然后选择<uicontrol>编辑</uicontrol>。选择<uicontrol>是</uicontrol>以启用 GPG 检查,然后输入存储库中 GPG 密钥文件的 URL。</p></dd>
+</dlentry><dlentry>
+<dt>调试报告</dt>
+<dd>本部分显示调试报告,其中包括名称和文件路径。您可以从选项中进行选择以生成新报告,或者对现有报告进行重命名、除去或下载。<p>调试报告将使用
+<cmdname>sosreport</cmdname> 命令生成。该报告可用于 Red
+Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>、Fedora 和 Ubuntu 分发版。该命令将生成包含配置和诊断信息的 .tar 文件,例如,正在运行的内核版本、已装入的模块以及系统和服务配置文件。该命令还会运行外部程序以收集更多信息并将此输出存储在生成的归档中。</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/help/zh_TW/host.dita b/plugins/gingerbase/ui/pages/help/zh_TW/host.dita
new file mode 100644
index 0000000..a55aae4
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/help/zh_TW/host.dita
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Arbortext, Inc., 1988-2011, v.4002-->
+<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
+ "..\dtd\cshelp.dtd">
+
+
+<!--This DITA specialized document type is not supported by the Authoring Tools development team.
+For support please see:
+https://w3.opensource.ibm.com/projects/dita-cshelp/-->
+<cshelp id="kimhhost" xml:lang="zh-tw">
+<title>主機</title>
+<shortdesc>「<wintitle>主機</wintitle>」頁面會顯示主機系統的相關資訊,並容許您關閉、重新啟動以及連接到主機。</shortdesc>
+<csbody>
+<p>您可以針對主機執行下列動作:<ul>
+<li>選取<uicontrol>關閉</uicontrol>以關閉主機系統。</li>
+<li>選取<uicontrol>重新啟動</uicontrol>以重新啟動主機系統。</li>
+<li>選取<uicontrol>連接</uicontrol>以開啟與主機系統的 VNC 連線(如果尚未連線到主機系統)。</li>
+</ul></p>
+<p>按一下下列區段以顯示主機的相關資訊:<dl>
+<dlentry>
+<dt>基本資訊</dt>
+<dd>此區段會顯示主機作業系統發行套件、版本、程式碼名稱、處理器類型以及記憶體數量 (GB)。</dd>
+</dlentry><dlentry>
+<dt>系統統計資料</dt>
+<dd>此區段會顯示一些圖形,以顯示主機的 CPU、記憶體、磁碟 I/O 和網路 I/O 的統計資料。選取<uicontrol>離開此頁面之後收集資料</uicontrol>以在主機標籤從視線中消失之後繼續收集資料。</dd>
+</dlentry><dlentry>
+<dt>軟體更新</dt>
+<dd>此區段會顯示具有可用更新的所有套件的相關資訊,包括套件名稱、版本、架構和儲存庫。您可以透過選取<uicontrol>全部更新</uicontrol>來更新所有列出的套件。不能選取個別套件以進行更新。</dd>
+</dlentry><dlentry>
+<dt>儲存庫</dt>
+<dd>此區段會顯示與主機系統相關聯的儲存庫。您可以新增、啟用、編輯或移除儲存庫。新增儲存庫可使它與主機系統相關聯,而啟用儲存庫則容許主機存取儲存庫。如果您的系統是
+Red Hat Enterprise Linux 或 Fedora,則可以新增 <filepath>yum</filepath> 儲存庫。如果您的系統是
+Ubuntu 或 Debian,則可以新增 <filepath>deb</filepath> 儲存庫。<p>如果您正在使用
+yum 儲存庫,則可以新增 GPG 檢查以驗證此儲存庫中的某個套件是否未毀損。選取儲存庫,然後選取<uicontrol>編輯</uicontrol>。選取<uicontrol>是</uicontrol>以啟用
+GPG 檢查,然後輸入儲存庫的 GPG 金鑰檔的 URL。</p></dd>
+</dlentry><dlentry>
+<dt>除錯報告</dt>
+<dd>此區段顯示除錯報告,包括名稱和檔案路徑。您可以選取選項以產生新報告、或是重新命名、移除或下載現有報告。<p>除錯報告是使用
+<cmdname>sosreport</cmdname> 指令產生的。該指令可用於 Red
+Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>、Fedora
+及 Ubuntu 發行套件。該指令會產生 .tar 檔案,其包含配置與診斷資訊,例如執行中的核心版本、已載入模組以及系統和服務配置檔案。該指令還會執行外部程式來收集更多資訊並將此輸出儲存在產生的保存檔中。</p> </dd>
+</dlentry></dl></p>
+</csbody>
+<?tm 1392659967 1?>
+</cshelp>
+
+
+<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
+<!-- T9N_SRC_ID 232 -->
+<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/gingerbase/ui/pages/host.html.tmpl b/plugins/gingerbase/ui/pages/host.html.tmpl
new file mode 100644
index 0000000..d87debc
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/host.html.tmpl
@@ -0,0 +1,177 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *#
+
+#unicode UTF-8
+#import gettext
+#from wok.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
+#silent _ = t.gettext
+#silent _t = t.gettext
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="plugins/kimchi/css/theme-default.min.css">
+<script src="plugins/kimchi/js/kimchi.min.js"></script>
+</head>
+<body>
+<div id="host-root-container">
+ <div class="toolbar">
+ <div class="tools">
+ </div>
+ </div>
+ <div id="host-content-container" class="empty-when-logged-off"></div>
+</div>
+
+<script id="host-tmpl" type="kimchi/template">
+ <div class="host-panel">
+ <div class="logo-container">
+ <div class="logo" style="background-image: url({logo});"></div>
+ </div>
+ <div id="host-info-container" class="info-container">
+ <h2 class="hostname">{hostname}</h2>
+ <div class="action-panel">
+ <button id="host-button-shutdown" class="btn-normal-1 stop">
+ <div class="button-icon action-icon-stop"></div>
+ $_("Shut down")
+ </button>
+ <button id="host-button-restart" class="btn-normal-1 restart">
+ <div class="button-icon action-icon-restart"></div>
+ $_("Restart")
+ </button>
+ <button class="btn-normal-1 connect" disabled="disabled">
+ <div class="button-icon action-icon-connect"></div>
+ $_("Connect")
+ </button>
+ </div>
+ <div class="host-section">
+ <h3 class="section-header"
+ aria-expanded="false"
+ aria-controls="content-sys-info">
+ $_("Basic Information")
+ </h3>
+ <div id="content-sys-info" class="section-content">
+ <div class="section-row">
+ <div class="section-label">$_("OS Distro")</div>
+ <div class="section-value">{os_distro}</div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("OS Version")</div>
+ <div class="section-value">{os_version}</div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("OS Code Name")</div>
+ <div class="section-value">{os_codename}</div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("Processor")</div>
+ <div class="section-value">{cpu_model}</div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("CPU(s)")</div>
+ <div class="section-value">{cpus}</div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("Memory")</div>
+ <div class="section-value">{memory}</div>
+ </div>
+ </div>
+ </div>
+ <div class="host-section">
+ <h3 class="section-header"
+ aria-controls="content-sys-statistics">
+ $_("System Statistics")
+ </h3>
+ <div id="content-sys-statistics" class="section-content">
+ <div class="section-row">
+ <div class="section-label">$_("CPU")</div>
+ <div class="section-value">
+ <div id="container-chart-cpu" class="inline-block"></div>
+ </div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("Memory")</div>
+ <div class="section-value">
+ <div id="container-chart-memory" class="inline-block"></div>
+ </div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("Disk I/O")</div>
+ <div class="section-value">
+ <div id="container-chart-disk-io" class="inline-block"></div>
+ </div>
+ </div>
+ <div class="section-row">
+ <div class="section-label">$_("Network I/O")</div>
+ <div class="section-value">
+ <div id="container-chart-network-io" class="inline-block"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="software-update-section" class="host-section hidden">
+ <h3 class="section-header"
+ aria-controls="content-software-update">
+ $_("Software Updates")
+ </h3>
+ <div id="content-software-update" class="section-content">
+ <div class="section-row">
+ <div class="section-value">
+ <div id="software-updates-grid-container"></div>
+ <div id="software-updates-progress-container" class="hidden">
+ <label for="software-updates-progress-textarea">$_("Update Progress")</label>
+ <textarea id="software-updates-progress-textarea" readonly></textarea>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="repositories-section" class="host-section hidden">
+ <h3 class="section-header"
+ aria-controls="content-repositories">
+ $_("Repositories")
+ </h3>
+ <div id="content-repositories" class="section-content">
+ <div class="section-row">
+ <div class="section-value">
+ <div id="repositories-grid-container"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="debug-report-section" class="host-section hidden">
+ <h3 class="section-header"
+ aria-controls="content-sys-reports">
+ $_("Debug Reports")
+ </h3>
+ <div id="content-sys-reports" class="section-content">
+ <div class="section-row">
+ <div class="section-value">
+ <div id="available-reports-grid-container"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</script>
+
+<script type="text/javascript">
+ kimchi.host_main();
+</script>
+</body>
+</html>
diff --git a/plugins/gingerbase/ui/pages/report-add.html.tmpl b/plugins/gingerbase/ui/pages/report-add.html.tmpl
new file mode 100644
index 0000000..25bf0a9
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/report-add.html.tmpl
@@ -0,0 +1,56 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *#
+#unicode UTF-8
+#import gettext
+#from wok.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
+#silent _ = t.gettext
+#silent _t = t.gettext
+<!DOCTYPE html>
+<div id="report-add-window" class="window">
+ <header>
+ <h1 class="title h1 grey">$_("Generate a New Debug Report")</h1>
+ </header>
+ <div class="content">
+ <form id="form-report-add">
+ <section class="form-section">
+ <h2>
+ <label for="report-name-textbox">$_("Report Name")</label>
+ </h2>
+ <div class="field">
+ <input type="text" class="text" id="report-name-textbox" name="name" />
+ <span class="icon-info-circled light-grey c1"></span>
+ <span class="info-add-debug-report">
+ $_("The name used to identify the report. If omitted, a name will be chosen based on current time. Name can contain: letters, digits, underscore (\"_\") and hyphen (\"-\").")
+ </span>
+ </div>
+ </section>
+ </form>
+ </div>
+ <footer>
+ <div class="btn-group">
+ <button id="button-report-add" class="btn-normal"><span class="text">$_("Generate")</span></button>
+ <button id="button-report-cancel" class="btn-normal close" type="button">
+ <span calss="text">$_("Cancel")</span>
+ </button>
+ </div>
+ </footer>
+</div>
+<script>
+ kimchi.report_add_main();
+</script>
diff --git a/plugins/gingerbase/ui/pages/report-rename.html.tmpl b/plugins/gingerbase/ui/pages/report-rename.html.tmpl
new file mode 100644
index 0000000..90a0a80
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/report-rename.html.tmpl
@@ -0,0 +1,56 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *#
+#unicode UTF-8
+#import gettext
+#from wok.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
+#silent _ = t.gettext
+#silent _t = t.gettext
+<!DOCTYPE html>
+<div id="report-rename-window" class="window">
+ <header>
+ <h1 class="title h1 grey">$_("Rename a Debug Report")</h1>
+ </header>
+ <div class="content">
+ <form id="form-report-rename">
+ <section class="form-section">
+ <h2>
+ <label for="report-name-textbox">$_("Report Name")</label>
+ </h2>
+ <div class="field">
+ <input type="text" class="text" id="report-name-textbox" name="name" />
+ <span class="icon-info-circled light-grey c1"></span>
+ <span class="info-debug-report-rename">
+ $_("The name used to identify the report. Name can contain: letters, digits and hyphen (\"-\").")
+ </span>
+ </div>
+ </section>
+ </form>
+ </div>
+ <footer>
+ <div class="btn-group">
+ <button id="button-report-rename" class="btn-normal"><span class="text">$_("Submit")</span></button>
+ <button id-"button-report-rename-cancel" class="btn-normal close" type="button">
+ <span class="text">$_("Cancel")</span>
+ </button>
+ </div>
+ </footer>
+</div>
+<script>
+ kimchi.report_rename_main();
+</script>
diff --git a/plugins/gingerbase/ui/pages/repository-add.html.tmpl b/plugins/gingerbase/ui/pages/repository-add.html.tmpl
new file mode 100644
index 0000000..950252a
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/repository-add.html.tmpl
@@ -0,0 +1,113 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *#
+#unicode UTF-8
+#import gettext
+#from wok.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
+#silent _ = t.gettext
+#silent _t = t.gettext
+<div id="repository-add-window" class="window">
+ <form id="form-repository-add">
+ <header class="window-header">
+ <h1 class="title h1 grey">$_("Add a Repository")</h1>
+ </header>
+ <section>
+ <div class="content">
+ <div class="form-section yum">
+ <h2>$_("Identifier")</h2>
+ <div class="field">
+ <div class="textbox-wrapper">
+ <input type="text" class="text" name="repo_id" />
+ </div>
+ <div class="icon-info-circled light-grey c1 help-inline"></div>
+ <p class="text-help help-inline">
+ $_("Single word, unique identifier for the repository.")
+ </p>
+ </div>
+ </div>
+ <section class="form-section yum">
+ <h2>$_("Name")</h2>
+ <div class="field">
+ <div class="textbox-wrapper">
+ <input type="text" class="text" name="config[repo_name]" />
+ </div>
+ <div class="icon-info-circled light-grey c1 help-inline"></div>
+ <p class="text-help help-inline">
+ $_("Textual name for the repository.")
+ </p>
+ </div>
+ </section>
+ <section class="form-section">
+ <h2>$_("URL")<span class="required" role="presentation" title='$_("Required Field")'>*</span></h2>
+ <div class="field">
+ <div class="textbox-wrapper">
+ <input type="text" class="text required" name="baseurl" />
+ </div>
+ <div class="icon-info-circled light-grey c1 help-inline"></div>
+ <p class="text-help help-inline">
+ $_("URL to the repository. Supported protocols are http, ftp, and file.")
+ </p>
+ </div>
+ <div class="field yum">
+ <p class="yum">
+ <input type="checkbox" name="isMirror" value="true" id="isMirror" />
+ <label id="isMirrorLabel" for="isMirror">$_("Repository is a mirror")</label>
+ </p>
+ </div>
+ </section>
+ <section class="form-section repository-dist deb">
+ <h2>$_("Distribution")</h2>
+ <div class="field">
+ <div class="textbox-wrapper">
+ <input type="text" class="text" name="config[dist]" />
+ </div>
+ <div class="icon-info-circled light-grey c1 help-inline"></div>
+ <p class="text-help help-inline">
+ $_("Distribution of the DEB repository.")
+ </p>
+ </div>
+ </section>
+ <section class="form-section repository-comps deb">
+ <h2>$_("Components")</h2>
+ <div class="field">
+ <div class="textbox-wrapper">
+ <input type="text" class="text" name="config[comps]" />
+ </div>
+ <div class="icon-info-circled light-grey c1 help-inline"></div>
+ <p class="text-help help-inline">
+ $_("List of components in DEB repository.")
+ </p>
+ </div>
+ </section>
+ </div>
+ </section>
+ <footer>
+ <div class="btn-group">
+ <button type="submit" id="button-repository-add" class="btn-normal" disabled="disabled">
+ <span class="text">$_("Add")</span>
+ </button>
+ <button type="button" id="button-repository-close" class="btn-normal close">
+ <span class="text">$("Cancel")</span>
+ </button>
+ </div>
+ </footer>
+ </form>
+</div>
+<script>
+ kimchi.repository_add_main();
+</script>
diff --git a/plugins/gingerbase/ui/pages/repository-edit.html.tmpl b/plugins/gingerbase/ui/pages/repository-edit.html.tmpl
new file mode 100644
index 0000000..e5a3cfb
--- /dev/null
+++ b/plugins/gingerbase/ui/pages/repository-edit.html.tmpl
@@ -0,0 +1,117 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014-2015
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *#
+#unicode UTF-8
+#import gettext
+#from wok.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
+#silent _ = t.gettext
+#silent _t = t.gettext
+
+<div id="repository-edit-window" class="window">
+ <form id="form-repository-edit">
+ <header>
+ <h1 class="title h1 grey">$_("Edit Repository")</h1>
+ </header>
+ <div class="content">
+ <section id="form-repository-edit">
+ <fieldset class="repository-edit-fieldset">
+ <div class="repository-id yum">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-id-textbox">$_("ID")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-id-textbox" name="repo_id" type="text" disabled="disabled" readonly="readonly"/>
+ </div>
+ </div>
+ <div class="repository-name yum">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-name-textbox">$_("Name")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-name-textbox" class="yum" name="config[repo_name]" type="text" />
+ </div>
+ </div>
+ <div class="repository-url">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-baseurl-textbox">$_("URL")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-baseurl-textbox" name="baseurl" type="text" />
+ </div>
+ </div>
+ <div class="repository-dist deb">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-urlargs-textbox">$_("Distribution")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-urlargs-textbox" class="deb" name="config[dist]" type="text" />
+ </div>
+ </div>
+ <div class="repository-mirrorlist yum">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-urlargs-textbox">$_("Mirror List URL")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-urlargs-textbox" class="yum" name="config[mirrorlist]" type="text" />
+ </div>
+ </div>
+ <div class="repository-comps deb">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-urlargs-textbox">$_("Components")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-urlargs-textbox" class="deb" name="config[comps]" type="text" />
+ </div>
+ </div>
+ <div class="repository-gpgkey yum">
+ <div class="repository-edit-wrapper-label">
+ <label for="repository-edit-gpgkey-textbox">$_("GPG Key")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-gpgkey-textbox" class="yum" name="config[gpgkey]" type="text" />
+ </div>
+ </div>
+ <div class="repository-gpgcheck yum">
+ <div class="repository-edit-wrapper-label">
+ <label>$_("GPG Check")</label>
+ </div>
+ <div class="repository-edit-wrapper-controls">
+ <input id="repository-edit-gpgcheck-radio-true" class="yum" name="config[gpgcheck]" type="radio" value="true" />
+ <label for="repository-edit-gpgcheck-radio-true">$_("Yes")</label>
+ <input id="repository-edit-gpgcheck-radio-false" class="yum" name="config[gpgcheck]" type="radio" value="false" />
+ <label for="repository-edit-gpgcheck-radio-false">$_("No")</label>
+ </div>
+ </div>
+ </fieldset>
+ </section>
+ </div>
+ <footer>
+ <div class="btn-group">
+ <button type="submit" id="repository-edit-button-save" class="btn-normal">
+ <span class="text">$_("Save")</span>
+ </button>
+ <button type="button" id="repository-edit-button-cancel" class="close btn-normal">
+ <span class="text">$_("Cancel")</span>
+ </button>
+ </div>
+ </footer>
+ </form>
+</div>
+<script type="text/javascript">
+ kimchi.repository_edit_main();
+</script>
diff --git a/plugins/gingerbase/yumparser.py b/plugins/gingerbase/yumparser.py
new file mode 100644
index 0000000..74f9fa0
--- /dev/null
+++ b/plugins/gingerbase/yumparser.py
@@ -0,0 +1,283 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import subprocess
+from os import listdir
+from os.path import isfile, splitext
+
+
+class YumRepoObject(object):
+
+ def __init__(self, repo_id, repofile):
+ self.repo_id = repo_id
+ self.name = None
+ self.baseurl = None
+ self.enabled = True
+ self.gpgcheck = True
+ self.gpgkey = None
+ self.metalink = None
+ self.mirrorlist = None
+ self.repofile = repofile
+ self.string_attrs = ['baseurl', 'gpgkey', 'name',
+ 'metalink', 'mirrorlist']
+ self.boolean_attrs = ['enabled', 'gpgcheck']
+
+ def set_attribute(self, key, strvalue):
+ if key in self.string_attrs:
+ setattr(self, key, strvalue)
+ elif key in self.boolean_attrs:
+ setattr(self, key, (strvalue == '1'))
+
+ def get_attribute_str(self, key):
+ if key not in self.get_attributes():
+ return None
+
+ if key in self.boolean_attrs:
+ str_value = '1' if getattr(self, key) is True else '0'
+ else:
+ str_value = getattr(self, key)
+
+ if str_value is None:
+ return None
+
+ return key + '=' + str_value
+
+ def get_attributes(self):
+ return self.string_attrs + self.boolean_attrs
+
+ def enable(self):
+ self.enabled = True
+
+ def disable(self):
+ self.enabled = False
+
+ def __str__(self):
+ str_obj = '[' + self.repo_id + ']' + '\n'
+ for key in self.get_attributes():
+ if self.get_attribute_str(key) is not None:
+ str_obj += self.get_attribute_str(key) + '\n'
+ return str_obj
+
+
+def get_repo_files():
+ def _is_repository_file(f):
+ _, f_extension = splitext(f)
+ return isfile(f) and (f_extension == '.repo')
+
+ YUM_REPO_DIR = '/etc/yum.repos.d'
+ return [YUM_REPO_DIR+'/'+f for f in listdir(YUM_REPO_DIR)
+ if _is_repository_file(YUM_REPO_DIR+'/'+f)]
+
+
+def _ignore_line_repo_file(line):
+ return line.startswith("#") or '=' not in line
+
+
+def _get_repos_from_file(repo_file):
+ repos_from_file = {}
+ current_repo = None
+ current_repo_id = None
+ with open(repo_file) as f:
+ for line in f.readlines():
+ line = line.strip()
+ if line.startswith("["):
+ if current_repo is not None:
+ repos_from_file[current_repo_id] = current_repo
+ current_repo_id = line.strip('[]')
+ current_repo = YumRepoObject(current_repo_id, repo_file)
+ continue
+ if _ignore_line_repo_file(line):
+ continue
+ key, value = line.split('=', 1)
+ key = key.strip()
+ value = value.strip()
+ current_repo.set_attribute(key, value)
+
+ # add the last repo from file.
+ if current_repo is not None:
+ repos_from_file[current_repo_id] = current_repo
+
+ return repos_from_file
+
+
+def get_yum_repositories():
+ repo_files = get_repo_files()
+ repos = {}
+ for yum_repo in repo_files:
+ repos.update(_get_repos_from_file(yum_repo))
+
+ return repos
+
+
+def _retrieve_repo_line_index(data, repo):
+ repo_entry = '[' + repo.repo_id + ']\n'
+ try:
+ repo_index = data.index(repo_entry)
+ except:
+ return None
+ return repo_index
+
+
+def _update_repo_file_data(data, repo, repo_index):
+ remaining_repo_attrs = repo.get_attributes()
+
+ for i in range(repo_index + 1, len(data)):
+ line = data[i].strip()
+ if line.startswith('['):
+ break
+ if _ignore_line_repo_file(line):
+ continue
+ key, _ = line.split('=', 1)
+ key = key.strip()
+ attr_str = repo.get_attribute_str(key)
+ if attr_str is None:
+ continue
+ remaining_repo_attrs.remove(key)
+ data[i] = attr_str + '\n'
+
+ for attr in remaining_repo_attrs:
+ attr_str = repo.get_attribute_str(attr)
+ if attr_str is None:
+ continue
+ data.insert(repo_index+1, attr_str + '\n')
+
+ return data
+
+
+def write_repo_to_file(repo):
+ with open(repo.repofile) as f:
+ data = f.readlines()
+
+ repo_index = _retrieve_repo_line_index(data, repo)
+ if repo_index is None:
+ return
+
+ data = _update_repo_file_data(data, repo, repo_index)
+
+ with open(repo.repofile, 'w') as f:
+ f.writelines(data)
+
+
+def _get_last_line_repo(data, repo_index):
+ stop_delete_index = None
+ for i in range(repo_index+1, len(data)):
+ line = data[i].strip()
+ if line.startswith('['):
+ stop_delete_index = i - 1
+ break
+ if stop_delete_index is None:
+ stop_delete_index = len(data) - 1
+
+ return stop_delete_index
+
+
+def _remove_repo_file_data(data, repo_index):
+ last_line_repo = _get_last_line_repo(data, repo_index)
+ for i in range(last_line_repo, repo_index - 1, -1):
+ data.pop(i)
+ return data
+
+
+def delete_repo_from_file(repo):
+ with open(repo.repofile) as f:
+ data = f.readlines()
+
+ repo_index = _retrieve_repo_line_index(data, repo)
+ if repo_index is None:
+ return
+
+ data = _remove_repo_file_data(data, repo_index)
+
+ with open(repo.repofile, 'w') as f:
+ f.writelines(data)
+
+
+class YumUpdatePackageObject(object):
+
+ def __init__(self, name, arch, version, repo):
+ self.name = name
+ self.arch = arch
+ self.version = version
+ self.ui_from_repo = repo
+
+
+def _include_line_checkupdate_output(line):
+ tokens = line.split()
+
+ if len(tokens) != 3:
+ return False
+
+ if '.' not in tokens[0]:
+ return False
+
+ return True
+
+
+def _ignore_obsoleting_packages_in(output):
+ out = ''
+ for l in output.split('\n'):
+ if 'Obsoleting ' in l:
+ break
+ out += l + '\n'
+ return out
+
+
+def _filter_lines_checkupdate_output(output):
+ if output is None:
+ return []
+
+ output = _ignore_obsoleting_packages_in(output)
+
+ out = [l for l in output.split('\n')
+ if _include_line_checkupdate_output(l)]
+ return out
+
+
+def _get_yum_checkupdate_output():
+ cmd = ['yum', 'check-update', '-d0']
+ yum_update_cmd = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, error = yum_update_cmd.communicate()
+ return_code = yum_update_cmd.returncode
+ if return_code == 1:
+ return None
+
+ return out
+
+
+def get_yum_packages_list_update(checkupdate_output=None):
+ if checkupdate_output is None:
+ checkupdate_output = _get_yum_checkupdate_output()
+
+ filtered_output = _filter_lines_checkupdate_output(checkupdate_output)
+
+ packages = []
+ for line in filtered_output:
+ line = line.split()
+ index = 0
+ name_arch = line[index]
+ index += 1
+ version = line[index]
+ index += 1
+ repo = line[index]
+ name, arch = name_arch.rsplit('.', 1)
+ packages.append(YumUpdatePackageObject(name, arch, version, repo))
+
+ return packages
diff --git a/plugins/kimchi/API.json b/plugins/kimchi/API.json
index f1f58ff..e75b35f 100644
--- a/plugins/kimchi/API.json
+++ b/plugins/kimchi/API.json
@@ -59,30 +59,6 @@
}
},
"properties": {
- "debugreports_create": {
- "type": "object",
- "error": "KCHDR0006E",
- "properties": {
- "name": {
- "description": "The name for the debug report file.",
- "type": "string",
- "pattern": "^[_A-Za-z0-9-]*$",
- "error": "KCHDR0007E"
- }
- }
- },
- "debugreport_update": {
- "type": "object",
- "properties": {
- "name": {
- "description": "New name of debug report",
- "type": "string",
- "pattern": "^[_A-Za-z0-9-]*$",
- "error": "KCHDR0007E"
- }
- },
- "additionalProperties": false
- },
"storagepools_create": {
"type": "object",
"error": "KCHPOOL0026E",
@@ -684,116 +660,6 @@
"additionalProperties": false,
"error": "KCHAPI0001E"
},
- "repositories_create": {
- "type": "object",
- "properties": {
- "repo_id": {
- "description": "Repository ID used for YUM repository.",
- "type": "string",
- "error": "KCHREPOS0001E"
- },
- "baseurl": {
- "description": "URL to the directory where the repodata directory of a repository is located. Can be an http://, ftp:// or file:// URL.",
- "type": "string",
- "error": "KCHREPOS0002E"
- },
- "config": {
- "description": "Dictionary containing repository configuration",
- "type": "object",
- "error": "KCHREPOS0003E",
- "properties": {
- "dist": {
- "description": "Distribution to DEB repository",
- "type": "string",
- "error": "KCHREPOS0004E"
- },
- "comps": {
- "description": "List of components to DEB repository",
- "type": "array",
- "error": "KCHREPOS0005E",
- "uniqueItems": true,
- "items": {
- "description": "Component name",
- "type": "string",
- "error": "KCHREPOS0006E"
- }
- },
- "repo_name": {
- "description": "YUM repository name",
- "type": "string",
- "error": "KCHREPOS0023E"
- },
- "mirrorlist": {
- "description": "URL to a file containing a list of baseurls",
- "type": "string",
- "error": "KCHREPOS0007E"
- },
- "metalink": {
- "description": "URL to a metalink file for the repomd.xml",
- "type": "string",
- "error": "KCHREPOS0029E"
- }
- }
- }
- },
- "additionalProperties": false,
- "error": "KCHAPI0001E"
- },
- "repository_update": {
- "type": "object",
- "properties": {
- "baseurl": {
- "description": "URL to the directory where the repodata directory of a repository is located. Can be an http://, ftp:// or file:// URL.",
- "type": "string",
- "error": "KCHREPOS0002E"
- },
- "config": {
- "description": "Dictionary containing repository configuration",
- "type": "object",
- "error": "KCHREPOS0003E",
- "properties": {
- "dist": {
- "description": "Distribution to DEB repository",
- "type": "string",
- "error": "KCHREPOS0004E"
- },
- "comps": {
- "description": "List of components to DEB repository",
- "type": "array",
- "error": "KCHREPOS0005E",
- "uniqueItems": true,
- "items": {
- "description": "Component name",
- "type": "string",
- "error": "KCHREPOS0006E"
- }
- },
- "repo_name": {
- "description": "Human-readable string describing the YUM repository.",
- "type": "string",
- "error": "KCHREPOS0008E"
- },
- "mirrorlist": {
- "description": "URL to a file containing a list of baseurls for YUM repository",
- "type": "string",
- "error": "KCHREPOS0007E"
- },
- "gpgcheck": {
- "description": "Indicates if a GPG signature check on the packages gotten from repository should be performed.",
- "type": "boolean",
- "error": "KCHREPOS0009E"
- },
- "gpgkey": {
- "description": "URL pointing to the ASCII-armored GPG key file for the repository.",
- "type": "string",
- "error": "KCHREPOS0010E"
- }
- }
- }
- },
- "additionalProperties": false,
- "error": "KCHAPI0001E"
- },
"devices_get_list": {
"type": "object",
"properties": {
diff --git a/plugins/kimchi/Makefile.am b/plugins/kimchi/Makefile.am
index faef341..e4a44f7 100644
--- a/plugins/kimchi/Makefile.am
+++ b/plugins/kimchi/Makefile.am
@@ -98,7 +98,6 @@ config.py: config.py.in Makefile
install-deb: install
cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
- mkdir -p $(DESTDIR)/var/lib/kimchi/debugreports
mkdir -p $(DESTDIR)/var/lib/kimchi/screenshots
mkdir -p $(DESTDIR)/var/lib/kimchi/isos
@@ -138,7 +137,7 @@ ChangeLog:
install-data-local:
$(MKDIR_P) $(DESTDIR)$(kimchidir)
$(INSTALL_DATA) API.json $(DESTDIR)$(kimchidir)/API.json
- mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,screenshots,isos}
+ mkdir -p $(DESTDIR)/var/lib/kimchi/{screenshots,isos}
uninstall-local:
$(RM) $(DESTDIR)$(kimchidir)/API.json
diff --git a/plugins/kimchi/config.py.in b/plugins/kimchi/config.py.in
index 80b72bd..5738c4d 100644
--- a/plugins/kimchi/config.py.in
+++ b/plugins/kimchi/config.py.in
@@ -38,10 +38,6 @@ def get_distros_store():
return os.path.join(PluginPaths('kimchi').conf_dir, 'distros.d')
-def get_debugreports_path():
- return os.path.join(PluginPaths('kimchi').state_dir, 'debugreports')
-
-
def get_screenshot_path():
return os.path.join(PluginPaths('kimchi').state_dir, 'screenshots')
diff --git a/plugins/kimchi/control/debugreports.py b/plugins/kimchi/control/debugreports.py
deleted file mode 100644
index b5a3072..0000000
--- a/plugins/kimchi/control/debugreports.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2013-2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-from wok.control.base import AsyncCollection, Resource
-from wok.control.utils import internal_redirect
-from wok.control.utils import UrlSubNode
-
-
- at UrlSubNode('debugreports', True)
-class DebugReports(AsyncCollection):
- def __init__(self, model):
- super(DebugReports, self).__init__(model)
- self.resource = DebugReport
- self.role_key = 'host'
- self.admin_methods = ['GET', 'POST']
-
- def _get_resources(self, filter_params):
- res_list = super(DebugReports, self)._get_resources(filter_params)
- return sorted(res_list, key=lambda x: x.data['time'], reverse=True)
-
-
-class DebugReport(Resource):
- def __init__(self, model, ident):
- super(DebugReport, self).__init__(model, ident)
- self.role_key = 'host'
- self.admin_methods = ['GET', 'PUT', 'POST']
- self.uri_fmt = '/debugreports/%s'
- self.content = DebugReportContent(model, ident)
-
- @property
- def data(self):
- return {'name': self.ident,
- 'uri': self.info['uri'],
- 'time': self.info['ctime']}
-
-
-class DebugReportContent(Resource):
- def __init__(self, model, ident):
- super(DebugReportContent, self).__init__(model, ident)
- self.role_key = 'host'
- self.admin_methods = ['GET']
-
- def get(self):
- self.lookup()
- raise internal_redirect(self.info['uri'])
diff --git a/plugins/kimchi/control/host.py b/plugins/kimchi/control/host.py
index 0a40f1b..c71c47b 100644
--- a/plugins/kimchi/control/host.py
+++ b/plugins/kimchi/control/host.py
@@ -19,7 +19,6 @@
from wok.control.base import Collection, Resource, SimpleCollection
from wok.control.utils import UrlSubNode
-from wok.exception import NotFoundError
from cpuinfo import CPUInfo
@@ -31,14 +30,7 @@ class Host(Resource):
self.role_key = 'host'
self.admin_methods = ['GET', 'POST']
self.uri_fmt = '/host/%s'
- self.reboot = self.generate_action_handler('reboot')
- self.shutdown = self.generate_action_handler('shutdown')
- self.stats = HostStats(self.model)
- self.partitions = Partitions(self.model)
self.devices = Devices(self.model)
- self.packagesupdate = PackagesUpdate(self.model)
- self.repositories = Repositories(self.model)
- self.swupdate = self.generate_action_handler_task('swupdate')
self.cpuinfo = CPUInfo(self.model)
@property
@@ -46,54 +38,6 @@ class Host(Resource):
return self.info
-class HostStats(Resource):
- def __init__(self, model, id=None):
- super(HostStats, self).__init__(model, id)
- self.role_key = 'host'
- self.admin_methods = ['GET']
- self.history = HostStatsHistory(self.model)
-
- @property
- def data(self):
- return self.info
-
-
-class HostStatsHistory(Resource):
- @property
- def data(self):
- return self.info
-
-
-class Partitions(Collection):
- def __init__(self, model):
- super(Partitions, self).__init__(model)
- self.role_key = 'storage'
- self.admin_methods = ['GET']
- self.resource = Partition
-
- # Defining get_resources in order to return list of partitions in UI
- # sorted by their path
- def _get_resources(self, flag_filter):
- res_list = super(Partitions, self)._get_resources(flag_filter)
- res_list = filter(lambda x: x.info['available'], res_list)
- res_list.sort(key=lambda x: x.info['path'])
- return res_list
-
-
-class Partition(Resource):
- def __init__(self, model, id):
- self.role_key = 'storage'
- self.admin_methods = ['GET']
- super(Partition, self).__init__(model, id)
-
- @property
- def data(self):
- if not self.info['available']:
- raise NotFoundError("KCHPART0001E", {'name': self.info['name']})
-
- return self.info
-
-
class Devices(Collection):
def __init__(self, model):
super(Devices, self).__init__(model)
@@ -115,43 +59,3 @@ class Device(Resource):
def data(self):
return self.info
-
-class PackagesUpdate(Collection):
- def __init__(self, model):
- super(PackagesUpdate, self).__init__(model)
- self.role_key = 'host'
- self.admin_methods = ['GET']
- self.resource = PackageUpdate
-
-
-class PackageUpdate(Resource):
- def __init__(self, model, id=None):
- super(PackageUpdate, self).__init__(model, id)
- self.role_key = 'host'
- self.admin_methods = ['GET']
-
- @property
- def data(self):
- return self.info
-
-
-class Repositories(Collection):
- def __init__(self, model):
- super(Repositories, self).__init__(model)
- self.role_key = 'host'
- self.admin_methods = ['GET', 'POST']
- self.resource = Repository
-
-
-class Repository(Resource):
- def __init__(self, model, id):
- super(Repository, self).__init__(model, id)
- self.role_key = 'host'
- self.admin_methods = ['GET', 'PUT', 'POST', 'DELETE']
- self.uri_fmt = "/host/repositories/%s"
- self.enable = self.generate_action_handler('enable')
- self.disable = self.generate_action_handler('disable')
-
- @property
- def data(self):
- return self.info
diff --git a/plugins/kimchi/disks.py b/plugins/kimchi/disks.py
deleted file mode 100644
index eb40e3a..0000000
--- a/plugins/kimchi/disks.py
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2013-2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import os.path
-import re
-import subprocess
-from parted import Device as PDevice
-from parted import Disk as PDisk
-
-from wok.exception import OperationFailed
-from wok.utils import wok_log
-
-
-def _get_dev_node_path(maj_min):
- """ Returns device node path given the device number 'major:min' """
-
- dm_name = "/sys/dev/block/%s/dm/name" % maj_min
- if os.path.exists(dm_name):
- with open(dm_name) as dm_f:
- content = dm_f.read().rstrip('\n')
- return "/dev/mapper/" + content
-
- uevent = "/sys/dev/block/%s/uevent" % maj_min
- with open(uevent) as ueventf:
- content = ueventf.read()
-
- data = dict(re.findall(r'(\S+)=(".*?"|\S+)', content.replace("\n", " ")))
-
- return "/dev/%s" % data["DEVNAME"]
-
-
-def _get_lsblk_devs(keys, devs=[]):
- lsblk = subprocess.Popen(
- ["lsblk", "-Pbo"] + [','.join(keys)] + devs,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, err = lsblk.communicate()
- if lsblk.returncode != 0:
- raise OperationFailed("KCHDISKS0001E", {'err': err})
-
- return _parse_lsblk_output(out, keys)
-
-
-def _get_dev_major_min(name):
- maj_min = None
-
- keys = ["NAME", "MAJ:MIN"]
- dev_list = _get_lsblk_devs(keys)
-
- for dev in dev_list:
- if dev['name'].split()[0] == name:
- maj_min = dev['maj:min']
- break
- else:
- raise OperationFailed("KCHDISKS0002E", {'device': name})
-
- return maj_min
-
-
-def _is_dev_leaf(devNodePath):
- try:
- # By default, lsblk prints a device information followed by children
- # device information
- childrenCount = len(
- _get_lsblk_devs(["NAME"], [devNodePath])) - 1
- except OperationFailed as e:
- # lsblk is known to fail on multipath devices
- # Assume these devices contain children
- wok_log.error(
- "Error getting device info for %s: %s", devNodePath, e)
- return False
-
- return childrenCount == 0
-
-
-def _is_dev_extended_partition(devType, devNodePath):
- if devType != 'part':
- return False
- diskPath = devNodePath.rstrip('0123456789')
- device = PDevice(diskPath)
- try:
- extended_part = PDisk(device).getExtendedPartition()
- except NotImplementedError as e:
- wok_log.warning(
- "Error getting extended partition info for dev %s type %s: %s",
- devNodePath, devType, e.message)
- # Treate disk with unsupported partiton table as if it does not
- # contain extended partitions.
- return False
- if extended_part and extended_part.path == devNodePath:
- return True
- return False
-
-
-def _parse_lsblk_output(output, keys):
- # output is on format key="value",
- # where key can be NAME, TYPE, FSTYPE, SIZE, MOUNTPOINT, etc
- lines = output.rstrip("\n").split("\n")
- r = []
- for line in lines:
- d = {}
- for key in keys:
- expression = r"%s=\".*?\"" % key
- match = re.search(expression, line)
- field = match.group()
- k, v = field.split('=', 1)
- d[k.lower()] = v[1:-1]
- r.append(d)
- return r
-
-
-def _get_vgname(devNodePath):
- """ Return volume group name of a physical volume. If the device node path
- is not a physical volume, return empty string. """
- pvs = subprocess.Popen(
- ["pvs", "--unbuffered", "--nameprefixes", "--noheadings",
- "-o", "vg_name", devNodePath],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, err = pvs.communicate()
- if pvs.returncode != 0:
- return ""
-
- return re.findall(r"LVM2_VG_NAME='([^\']*)'", out)[0]
-
-
-def _is_available(name, devtype, fstype, mountpoint, majmin):
- devNodePath = _get_dev_node_path(majmin)
- # Only list unmounted and unformated and leaf and (partition or disk)
- # leaf means a partition, a disk has no partition, or a disk not held
- # by any multipath device. Physical volume belongs to no volume group
- # is also listed. Extended partitions should not be listed.
- if (devtype in ['part', 'disk', 'mpath'] and
- fstype in ['', 'LVM2_member'] and
- mountpoint == "" and
- _get_vgname(devNodePath) == "" and
- _is_dev_leaf(devNodePath) and
- not _is_dev_extended_partition(devtype, devNodePath)):
- return True
- return False
-
-
-def get_partitions_names(check=False):
- names = set()
- keys = ["NAME", "TYPE", "FSTYPE", "MOUNTPOINT", "MAJ:MIN"]
- # output is on format key="value",
- # where key can be NAME, TYPE, FSTYPE, MOUNTPOINT
- for dev in _get_lsblk_devs(keys):
- # split()[0] to avoid the second part of the name, after the
- # whiteline
- name = dev['name'].split()[0]
- if check and not _is_available(name, dev['type'], dev['fstype'],
- dev['mountpoint'], dev['maj:min']):
- continue
- names.add(name)
-
- return list(names)
-
-
-def get_partition_details(name):
- majmin = _get_dev_major_min(name)
- dev_path = _get_dev_node_path(majmin)
-
- keys = ["TYPE", "FSTYPE", "SIZE", "MOUNTPOINT"]
- try:
- dev = _get_lsblk_devs(keys, [dev_path])[0]
- except OperationFailed as e:
- wok_log.error(
- "Error getting partition info for %s: %s", name, e)
- return {}
-
- dev['available'] = _is_available(name, dev['type'], dev['fstype'],
- dev['mountpoint'], majmin)
- if dev['mountpoint']:
- # Sometimes the mountpoint comes with [SWAP] or other
- # info which is not an actual mount point. Filtering it
- regexp = re.compile(r"\[.*\]")
- if regexp.search(dev['mountpoint']) is not None:
- dev['mountpoint'] = ''
- dev['path'] = dev_path
- dev['name'] = name
- return dev
diff --git a/plugins/kimchi/docs/README.md b/plugins/kimchi/docs/README.md
index f400333..ee6bfed 100644
--- a/plugins/kimchi/docs/README.md
+++ b/plugins/kimchi/docs/README.md
@@ -196,13 +196,13 @@ Usage
Connect your browser to https://localhost:8001. You should see a screen like:
-![Wok Login Screen](/docs/kimchi-login.png)
+![Wok Login Screen](docs/kimchi-login.png)
Wok uses PAM to authenticate users so you can log in with the same username
and password that you would use to log in to the machine itself. Once logged in
you will see a screen like:
-![Kimchi Guest View](/docs/kimchi-guest.png)
+![Kimchi Guest View](docs/kimchi-guest.png)
This shows you the list of running guests including a live screenshot of
the guest session. You can use the action buttons to shutdown the guests
@@ -216,7 +216,7 @@ top navigation bar.
The template screen looks like:
-![Kimchi Template View](/docs/kimchi-templates.png)
+![Kimchi Template View](docs/kimchi-templates.png)
From this view, you can change the parameters of a template or create a
new template using the "+" button in the upper right corner.
diff --git a/plugins/kimchi/i18n.py b/plugins/kimchi/i18n.py
index 220bd24..e9699b9 100644
--- a/plugins/kimchi/i18n.py
+++ b/plugins/kimchi/i18n.py
@@ -244,31 +244,12 @@ messages = {
"KCHNET0021E": _("Failed to activate interface %(iface)s. Please check the physical link status."),
"KCHNET0022E": _("Failed to start network %(name)s. Details: %(err)s"),
- "KCHDR0001E": _("Debug report %(name)s does not exist"),
- "KCHDR0002E": _("Debug report tool not found in system"),
- "KCHDR0003E": _("Unable to create debug report %(name)s. Details: %(err)s."),
- "KCHDR0004E": _("Can not find any debug report with the given name %(name)s"),
- "KCHDR0005E": _("Unable to generate debug report %(name)s. Details: %(err)s"),
- "KCHDR0006E": _("You should give a name for the debug report file."),
- "KCHDR0007E": _("Debug report name must be a string. Only letters, digits, underscore ('_') and hyphen ('-') are allowed."),
- "KCHDR0008E": _("The debug report with specified name \"%(name)s\" already exists. Please use another one."),
-
"KCHSR0001E": _("Storage server %(server)s was not used by Kimchi"),
"KCHDISTRO0001E": _("Distro '%(name)s' does not exist"),
"KCHPART0001E": _("Partition %(name)s does not exist in the host"),
- "KCHHOST0001E": _("Unable to shutdown host machine as there are running virtual machines"),
- "KCHHOST0002E": _("Unable to reboot host machine as there are running virtual machines"),
- "KCHHOST0003E": _("Node device '%(name)s' not found"),
- "KCHHOST0004E": _("Conflicting flag filters specified."),
-
- "KCHPKGUPD0001E": _("No packages marked for update"),
- "KCHPKGUPD0002E": _("Package %(name)s is not marked to be updated."),
- "KCHPKGUPD0003E": _("Error while getting packages marked to be updated. Details: %(err)s"),
- "KCHPKGUPD0004E": _("There is no compatible package manager for this system."),
-
"KCHUTILS0001E": _("Invalid URI %(uri)s"),
"KCHUTILS0003E": _("Unable to choose a virtual machine name"),
@@ -288,37 +269,6 @@ messages = {
"KCHVMSTOR0017E": _("Only one of path or pool/volume can be specified to add a new virtual machine disk"),
"KCHVMSTOR0018E": _("Volume chosen with format %(format)s does not fit in the storage type %(type)s"),
- "KCHREPOS0001E": _("YUM Repository ID must be one word only string."),
- "KCHREPOS0002E": _("Repository URL must be an http://, ftp:// or file:// URL."),
- "KCHREPOS0003E": _("Repository configuration is a dictionary with specific values according to repository type."),
- "KCHREPOS0004E": _("Distribution to DEB repository must be a string"),
- "KCHREPOS0005E": _("Components to DEB repository must be listed in a array"),
- "KCHREPOS0006E": _("Components to DEB repository must be a string"),
- "KCHREPOS0007E": _("Mirror list to repository must be a string"),
- "KCHREPOS0008E": _("YUM Repository name must be string."),
- "KCHREPOS0009E": _("GPG check must be a boolean value."),
- "KCHREPOS0010E": _("GPG key must be a URL pointing to the ASCII-armored file."),
- "KCHREPOS0011E": _("Could not update repository %(repo_id)s."),
- "KCHREPOS0012E": _("Repository %(repo_id)s does not exist."),
- "KCHREPOS0013E": _("Specify repository base URL, mirror list or metalink in order to create or update a YUM repository."),
- "KCHREPOS0014E": _("Repository management tool was not recognized for your system."),
- "KCHREPOS0015E": _("Repository %(repo_id)s is already enabled."),
- "KCHREPOS0016E": _("Repository %(repo_id)s is already disabled."),
- "KCHREPOS0017E": _("Could not remove repository %(repo_id)s."),
- "KCHREPOS0018E": _("Could not write repository configuration file %(repo_file)s"),
- "KCHREPOS0019E": _("Specify repository distribution in order to create a DEB repository."),
- "KCHREPOS0020E": _("Could not enable repository %(repo_id)s."),
- "KCHREPOS0021E": _("Could not disable repository %(repo_id)s."),
- "KCHREPOS0022E": _("YUM Repository ID already exists"),
- "KCHREPOS0023E": _("YUM Repository name must be a string"),
- "KCHREPOS0024E": _("Unable to list repositories. Details: '%(err)s'"),
- "KCHREPOS0025E": _("Unable to retrieve repository information. Details: '%(err)s'"),
- "KCHREPOS0026E": _("Unable to add repository. Details: '%(err)s'"),
- "KCHREPOS0027E": _("Unable to remove repository. Details: '%(err)s'"),
- "KCHREPOS0028E": _("Configuration items: '%(items)s' are not supported by repository manager"),
- "KCHREPOS0029E": _("Repository metalink must be an http://, ftp:// or file:// URL."),
- "KCHREPOS0030E": _("Cannot specify mirrorlist and metalink at the same time."),
-
"KCHSNAP0001E": _("Virtual machine '%(vm)s' must be stopped before creating a snapshot of it."),
"KCHSNAP0002E": _("Unable to create snapshot '%(name)s' on virtual machine '%(vm)s'. Details: %(err)s"),
"KCHSNAP0003E": _("Snapshot '%(name)s' does not exist on virtual machine '%(vm)s'."),
diff --git a/plugins/kimchi/kimchi.conf b/plugins/kimchi/kimchi.conf
index 78f4f3f..98a6c57 100644
--- a/plugins/kimchi/kimchi.conf
+++ b/plugins/kimchi/kimchi.conf
@@ -23,13 +23,6 @@ tools.staticdir.on = True
tools.staticdir.dir = wok.config.PluginPaths('kimchi').state_dir + '/screenshots'
tools.nocache.on = False
-[/data/debugreports]
-tools.staticdir.on = True
-tools.staticdir.dir = wok.config.PluginPaths('kimchi').state_dir + '/debugreports'
-tools.nocache.on = False
-tools.wokauth.on = True
-tools.staticdir.content_types = {'xz': 'application/x-xz'}
-
[/favicon.ico]
tools.staticfile.on = True
tools.staticfile.filename = wok.config.PluginPaths('kimchi').ui_dir + '/images/logo.ico'
diff --git a/plugins/kimchi/mockmodel.py b/plugins/kimchi/mockmodel.py
index e316c21..68acf6f 100644
--- a/plugins/kimchi/mockmodel.py
+++ b/plugins/kimchi/mockmodel.py
@@ -33,8 +33,6 @@ from wok.xmlutils.utils import xml_item_update
import config
import imageinfo
import osinfo
-from model import cpuinfo
-from model.debugreports import DebugReportsModel
from model.host import DeviceModel
from model.libvirtstoragepool import IscsiPoolDef, NetfsPoolDef
from model.libvirtstoragepool import StoragePoolDef
@@ -73,8 +71,6 @@ class MockModel(Model):
self._mock_swupdate = MockSoftwareUpdate()
self._mock_repositories = MockRepositories()
- cpuinfo.get_topo_capabilities = \
- MockModel.get_topo_capabilities
libvirt.virConnect.defineXML = MockModel.domainDefineXML
libvirt.virDomain.XMLDesc = MockModel.domainXMLDesc
libvirt.virDomain.undefine = MockModel.undefineDomain
@@ -112,7 +108,6 @@ class MockModel(Model):
StoragePoolModel._update_lvm_disks = self._update_lvm_disks
StorageVolumesModel.get_list = self._mock_storagevolumes_get_list
StorageVolumeModel.doUpload = self._mock_storagevolume_doUpload
- DebugReportsModel._gen_debugreport_file = self._gen_debugreport_file
LibvirtVMTemplate._get_volume_path = self._get_volume_path
VMTemplate.get_iso_info = self._probe_image
imageinfo.probe_image = self._probe_image
@@ -244,22 +239,6 @@ class MockModel(Model):
return MockModel._libvirt_get_vol_path(pool, vol)
- def _gen_debugreport_file(self, name):
- return add_task('/plugins/kimchi/debugreports/%s' % name, self._create_log,
- self.objstore, name)
-
- def _create_log(self, cb, name):
- path = config.get_debugreports_path()
- tmpf = os.path.join(path, name + '.tmp')
- realf = os.path.join(path, name + '.txt')
- length = random.randint(1000, 10000)
- with open(tmpf, 'w') as fd:
- while length:
- fd.write('I am logged')
- length = length - 1
- os.rename(tmpf, realf)
- cb("OK", True)
-
def _update_lvm_disks(self, pool_name, disks):
conn = self.conn.get()
pool = conn.storagePoolLookupByName(pool_name.encode('utf-8'))
diff --git a/plugins/kimchi/model/config.py b/plugins/kimchi/model/config.py
index 371e382..5c984ee 100644
--- a/plugins/kimchi/model/config.py
+++ b/plugins/kimchi/model/config.py
@@ -28,10 +28,7 @@ from wok.utils import check_url_path, run_command, wok_log
from ..config import find_qemu_binary
from ..distroloader import DistroLoader
-from ..repositories import Repositories
from ..screenshot import VMScreenshot
-from ..swupdate import SoftwareUpdate
-from debugreports import DebugReportsModel
from featuretests import FeatureTests, FEATURETEST_POOL_NAME
from featuretests import FEATURETEST_VM_NAME
@@ -116,28 +113,10 @@ class CapabilitiesModel(object):
return False
def lookup(self, *ident):
- report_tool = DebugReportsModel.get_system_report_tool()
- try:
- SoftwareUpdate()
- except Exception:
- update_tool = False
- else:
- update_tool = True
-
- try:
- repo = Repositories()
- except Exception:
- repo_mngt_tool = None
- else:
- repo_mngt_tool = repo._pkg_mnger.TYPE
-
return {'libvirt_stream_protocols': self.libvirt_stream_protocols,
'qemu_spice': self._qemu_support_spice(),
'qemu_stream': self.qemu_stream,
'screenshot': VMScreenshot.get_stream_test_result(),
- 'system_report_tool': bool(report_tool),
- 'update_tool': update_tool,
- 'repo_mngt_tool': repo_mngt_tool,
'federation': kconfig.get("server", "federation"),
'auth': kconfig.get("authentication", "method"),
'kernel_vfio': self.kernel_vfio,
diff --git a/plugins/kimchi/model/debugreports.py b/plugins/kimchi/model/debugreports.py
deleted file mode 100644
index d20eb12..0000000
--- a/plugins/kimchi/model/debugreports.py
+++ /dev/null
@@ -1,213 +0,0 @@
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2014-2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import fnmatch
-import glob
-import logging
-import os
-import shutil
-import subprocess
-import time
-
-from wok.exception import InvalidParameter, NotFoundError, OperationFailed
-from wok.exception import WokException
-from wok.utils import add_task, wok_log
-from wok.utils import run_command
-
-from .. import config
-from tasks import TaskModel
-
-
-class DebugReportsModel(object):
- def __init__(self, **kargs):
- self.objstore = kargs['objstore']
- self.task = TaskModel(**kargs)
-
- def create(self, params):
- ident = params.get('name').strip()
- # Generate a name with time and millisec precision, if necessary
- if ident is None or ident == "":
- ident = 'report-' + str(int(time.time() * 1000))
- else:
- if ident in self.get_list():
- raise InvalidParameter("KCHDR0008E", {"name": ident})
- taskid = self._gen_debugreport_file(ident)
- return self.task.lookup(taskid)
-
- def get_list(self):
- path = config.get_debugreports_path()
- file_pattern = os.path.join(path, '*.*')
- file_lists = glob.glob(file_pattern)
- file_lists = [os.path.split(file)[1] for file in file_lists]
- name_lists = [file.split('.', 1)[0] for file in file_lists]
-
- return name_lists
-
- def _gen_debugreport_file(self, name):
- gen_cmd = self.get_system_report_tool()
-
- if gen_cmd is not None:
- return add_task('/plugins/kimchi/debugreports/%s' % name, gen_cmd,
- self.objstore, name)
-
- raise OperationFailed("KCHDR0002E")
-
- @staticmethod
- def sosreport_generate(cb, name):
- def log_error(e):
- log = logging.getLogger('Model')
- log.warning('Exception in generating debug file: %s', e)
-
- try:
- command = ['sosreport', '--batch', '--name=%s' % name]
- output, error, retcode = run_command(command)
-
- if retcode != 0:
- raise OperationFailed("KCHDR0003E", {'name': name,
- 'err': retcode})
-
- # SOSREPORT might create file in /tmp or /var/tmp
- # FIXME: The right way should be passing the tar.xz file directory
- # though the parameter '--tmp-dir', but it is failing in Fedora 20
- patterns = ['/tmp/sosreport-%s-*', '/var/tmp/sosreport-%s-*']
- reports = []
- reportFile = None
- for p in patterns:
- reports = reports + [f for f in glob.glob(p % name)]
- for f in reports:
- if not fnmatch.fnmatch(f, '*.md5'):
- reportFile = f
- break
- # Some error in sosreport happened
- if reportFile is None:
- wok_log.error('Debug report file not found. See sosreport '
- 'output for detail:\n%s', output)
- fname = (patterns[0] % name).split('/')[-1]
- raise OperationFailed('KCHDR0004E', {'name': fname})
-
- md5_report_file = reportFile + '.md5'
- report_file_extension = '.' + reportFile.split('.', 1)[1]
- path = config.get_debugreports_path()
- target = os.path.join(path, name + report_file_extension)
- # Moving report
- msg = 'Moving debug report file "%s" to "%s"' % (reportFile,
- target)
- wok_log.info(msg)
- shutil.move(reportFile, target)
- # Deleting md5
- msg = 'Deleting report md5 file: "%s"' % (md5_report_file)
- wok_log.info(msg)
- with open(md5_report_file) as f:
- md5 = f.read().strip()
- wok_log.info('Md5 file content: "%s"', md5)
- os.remove(md5_report_file)
- cb('OK', True)
- return
-
- except WokException as e:
- log_error(e)
- raise
-
- except OSError as e:
- log_error(e)
- raise
-
- except Exception, e:
- # No need to call cb to update the task status here.
- # The task object will catch the exception raised here
- # and update the task status there
- log_error(e)
- raise OperationFailed("KCHDR0005E", {'name': name, 'err': e})
-
- @staticmethod
- def get_system_report_tool():
- # Please add new possible debug report command here
- # and implement the report generating function
- # based on the new report command
- report_tools = ({'cmd': 'sosreport --help',
- 'fn': DebugReportsModel.sosreport_generate},)
-
- # check if the command can be found by shell one by one
- for helper_tool in report_tools:
- try:
- retcode = subprocess.call(helper_tool['cmd'], shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- if retcode == 0:
- return helper_tool['fn']
- except Exception, e:
- wok_log.info('Exception running command: %s', e)
-
- return None
-
-
-class DebugReportModel(object):
- def __init__(self, **kargs):
- pass
-
- def lookup(self, name):
- path = config.get_debugreports_path()
- file_pattern = os.path.join(path, name)
- file_pattern = file_pattern + '.*'
- try:
- file_target = glob.glob(file_pattern)[0]
- except IndexError:
- raise NotFoundError("KCHDR0001E", {'name': name})
-
- ctime = os.stat(file_target).st_mtime
- ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
- file_target = os.path.split(file_target)[-1]
- file_target = os.path.join("plugins/kimchi/data/debugreports",
- file_target)
- return {'uri': file_target,
- 'ctime': ctime}
-
- def update(self, name, params):
- path = config.get_debugreports_path()
- file_pattern = os.path.join(path, name + '.*')
- try:
- file_source = glob.glob(file_pattern)[0]
- except IndexError:
- raise NotFoundError("KCHDR0001E", {'name': name})
-
- file_target = file_source.replace(name, params['name'])
- if os.path.isfile(file_target):
- raise InvalidParameter('KCHDR0008E', {'name': params['name']})
-
- shutil.move(file_source, file_target)
- wok_log.info('%s renamed to %s' % (file_source, file_target))
- return params['name']
-
- def delete(self, name):
- path = config.get_debugreports_path()
- file_pattern = os.path.join(path, name + '.*')
- try:
- file_target = glob.glob(file_pattern)[0]
- except IndexError:
- raise NotFoundError("KCHDR0001E", {'name': name})
-
- os.remove(file_target)
-
-
-class DebugReportContentModel(object):
- def __init__(self, **kargs):
- self._debugreport = DebugReportModel()
-
- def lookup(self, name):
- return self._debugreport.lookup(name)
diff --git a/plugins/kimchi/model/host.py b/plugins/kimchi/model/host.py
index 3ff034c..e24c686 100644
--- a/plugins/kimchi/model/host.py
+++ b/plugins/kimchi/model/host.py
@@ -18,27 +18,15 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import libvirt
-import os
-import platform
import psutil
-import time
-from cherrypy.process.plugins import BackgroundTask
-from collections import defaultdict
-from wok import netinfo
-from wok.basemodel import Singleton
from wok.exception import InvalidOperation, InvalidParameter
from wok.exception import NotFoundError, OperationFailed
-from wok.utils import add_task, wok_log
from wok.xmlutils.utils import xpath_get_text
import hostdev
-from .. import disks
-from ..repositories import Repositories
-from ..swupdate import SoftwareUpdate
from config import CapabilitiesModel
from tasks import TaskModel
-from vms import DOM_STATE_MAP
HOST_STATS_INTERVAL = 1
@@ -49,57 +37,6 @@ class HostModel(object):
self.conn = kargs['conn']
self.objstore = kargs['objstore']
self.task = TaskModel(**kargs)
- self.host_info = self._get_host_info()
-
- def _get_ppc_cpu_info(self):
- res = {}
- with open('/proc/cpuinfo') as f:
- for line in f.xreadlines():
- # Parse CPU, CPU's revision and CPU's clock information
- for key in ['cpu', 'revision', 'clock']:
- if key in line:
- info = line.split(':')[1].strip()
- if key == 'clock':
- value = float(info.split('MHz')[0].strip()) / 1000
- else:
- value = info.split('(')[0].strip()
- res[key] = value
-
- # Power machines show, for each cpu/core, a block with
- # all cpu information. Here we control the scan of the
- # necessary information (1st block provides
- # everything), skipping the function when find all
- # information.
- if len(res.keys()) == 3:
- return "%(cpu)s (%(revision)s) @ %(clock)s GHz\
- " % res
-
- return ""
-
- def _get_host_info(self):
- res = {}
- if platform.machine().startswith('ppc'):
- res['cpu_model'] = self._get_ppc_cpu_info()
- else:
- with open('/proc/cpuinfo') as f:
- for line in f.xreadlines():
- if "model name" in line:
- res['cpu_model'] = line.split(':')[1].strip()
- break
-
- res['cpus'] = 0
- res['memory'] = 0L
-
- # Include IBM PowerKVM name to supported distro names
- _sup_distros = platform._supported_dists + ('ibm_powerkvm',)
- # 'fedora' '17' 'Beefy Miracle'
- distro, version, codename = platform.linux_distribution(
- supported_dists=_sup_distros)
- res['os_distro'] = distro
- res['os_version'] = version
- res['os_codename'] = unicode(codename, "utf-8")
-
- return res
def lookup(self, *name):
cpus = psutil.NUM_CPUS
@@ -121,179 +58,6 @@ class HostModel(object):
self.host_info['memory'] = psutil.phymem_usage().total
return self.host_info
- def swupdate(self, *name):
- try:
- swupdate = SoftwareUpdate()
- except:
- raise OperationFailed('KCHPKGUPD0004E')
-
- pkgs = swupdate.getNumOfUpdates()
- if pkgs == 0:
- raise OperationFailed('KCHPKGUPD0001E')
-
- wok_log.debug('Host is going to be updated.')
- taskid = add_task('/plugins/kimchi/host/swupdate', swupdate.doUpdate,
- self.objstore, None)
- return self.task.lookup(taskid)
-
- def shutdown(self, args=None):
- # Check for running vms before shutdown
- running_vms = self._get_vms_list_by_state('running')
- if len(running_vms) > 0:
- raise OperationFailed("KCHHOST0001E")
-
- wok_log.info('Host is going to shutdown.')
- os.system('shutdown -h now')
-
- def reboot(self, args=None):
- # Find running VMs
- running_vms = self._get_vms_list_by_state('running')
- if len(running_vms) > 0:
- raise OperationFailed("KCHHOST0002E")
-
- wok_log.info('Host is going to reboot.')
- os.system('reboot')
-
- def _get_vms_list_by_state(self, state):
- conn = self.conn.get()
- return [dom.name().decode('utf-8')
- for dom in conn.listAllDomains(0)
- if (DOM_STATE_MAP[dom.info()[0]]) == state]
-
-
-class HostStatsModel(object):
- __metaclass__ = Singleton
-
- def __init__(self, **kargs):
- self.host_stats = defaultdict(list)
- self.host_stats_thread = BackgroundTask(HOST_STATS_INTERVAL,
- self._update_host_stats)
- self.host_stats_thread.start()
-
- def lookup(self, *name):
- return {'cpu_utilization': self.host_stats['cpu_utilization'][-1],
- 'memory': self.host_stats['memory'][-1],
- 'disk_read_rate': self.host_stats['disk_read_rate'][-1],
- 'disk_write_rate': self.host_stats['disk_write_rate'][-1],
- 'net_recv_rate': self.host_stats['net_recv_rate'][-1],
- 'net_sent_rate': self.host_stats['net_sent_rate'][-1]}
-
- def _update_host_stats(self):
- preTimeStamp = self.host_stats['timestamp']
- timestamp = time.time()
- # FIXME when we upgrade psutil, we can get uptime by psutil.uptime
- # we get uptime by float(open("/proc/uptime").readline().split()[0])
- # and calculate the first io_rate after the OS started.
- with open("/proc/uptime") as time_f:
- seconds = (timestamp - preTimeStamp if preTimeStamp else
- float(time_f.readline().split()[0]))
-
- self.host_stats['timestamp'] = timestamp
- self._get_host_disk_io_rate(seconds)
- self._get_host_network_io_rate(seconds)
-
- self._get_percentage_host_cpu_usage()
- self._get_host_memory_stats()
-
- # store only 60 stats (1 min)
- for key, value in self.host_stats.iteritems():
- if isinstance(value, list):
- if len(value) == 60:
- self.host_stats[key] = value[10:]
-
- def _get_percentage_host_cpu_usage(self):
- # This is cpu usage producer. This producer will calculate the usage
- # at an interval of HOST_STATS_INTERVAL.
- # The psutil.cpu_percent works as non blocking.
- # psutil.cpu_percent maintains a cpu time sample.
- # It will update the cpu time sample when it is called.
- # So only this producer can call psutil.cpu_percent in kimchi.
- self.host_stats['cpu_utilization'].append(psutil.cpu_percent(None))
-
- def _get_host_memory_stats(self):
- virt_mem = psutil.virtual_memory()
- # available:
- # the actual amount of available memory that can be given
- # instantly to processes that request more memory in bytes; this
- # is calculated by summing different memory values depending on
- # the platform (e.g. free + buffers + cached on Linux)
- memory_stats = {'total': virt_mem.total,
- 'free': virt_mem.free,
- 'cached': virt_mem.cached,
- 'buffers': virt_mem.buffers,
- 'avail': virt_mem.available}
- self.host_stats['memory'].append(memory_stats)
-
- def _get_host_disk_io_rate(self, seconds):
- disk_read_bytes = self.host_stats['disk_read_bytes']
- disk_write_bytes = self.host_stats['disk_write_bytes']
- prev_read_bytes = disk_read_bytes[-1] if disk_read_bytes else 0
- prev_write_bytes = disk_write_bytes[-1] if disk_write_bytes else 0
-
- disk_io = psutil.disk_io_counters(False)
- read_bytes = disk_io.read_bytes
- write_bytes = disk_io.write_bytes
-
- rd_rate = int(float(read_bytes - prev_read_bytes) / seconds + 0.5)
- wr_rate = int(float(write_bytes - prev_write_bytes) / seconds + 0.5)
-
- self.host_stats['disk_read_rate'].append(rd_rate)
- self.host_stats['disk_write_rate'].append(wr_rate)
- self.host_stats['disk_read_bytes'].append(read_bytes)
- self.host_stats['disk_write_bytes'].append(write_bytes)
-
- def _get_host_network_io_rate(self, seconds):
- net_recv_bytes = self.host_stats['net_recv_bytes']
- net_sent_bytes = self.host_stats['net_sent_bytes']
- prev_recv_bytes = net_recv_bytes[-1] if net_recv_bytes else 0
- prev_sent_bytes = net_sent_bytes[-1] if net_sent_bytes else 0
-
- net_ios = psutil.network_io_counters(True)
- recv_bytes = 0
- sent_bytes = 0
- for key in set(netinfo.nics() +
- netinfo.wlans()) & set(net_ios.iterkeys()):
- recv_bytes = recv_bytes + net_ios[key].bytes_recv
- sent_bytes = sent_bytes + net_ios[key].bytes_sent
-
- rx_rate = int(float(recv_bytes - prev_recv_bytes) / seconds + 0.5)
- tx_rate = int(float(sent_bytes - prev_sent_bytes) / seconds + 0.5)
-
- self.host_stats['net_recv_rate'].append(rx_rate)
- self.host_stats['net_sent_rate'].append(tx_rate)
- self.host_stats['net_recv_bytes'].append(recv_bytes)
- self.host_stats['net_sent_bytes'].append(sent_bytes)
-
-
-class HostStatsHistoryModel(object):
- def __init__(self, **kargs):
- self.history = HostStatsModel(**kargs)
-
- def lookup(self, *name):
- return {'cpu_utilization': self.history.host_stats['cpu_utilization'],
- 'memory': self.history.host_stats['memory'],
- 'disk_read_rate': self.history.host_stats['disk_read_rate'],
- 'disk_write_rate': self.history.host_stats['disk_write_rate'],
- 'net_recv_rate': self.history.host_stats['net_recv_rate'],
- 'net_sent_rate': self.history.host_stats['net_sent_rate']}
-
-
-class PartitionsModel(object):
- def __init__(self, **kargs):
- pass
-
- def get_list(self):
- result = disks.get_partitions_names()
- return result
-
-
-class PartitionModel(object):
- def __init__(self, **kargs):
- pass
-
- def lookup(self, name):
- return disks.get_partition_details(name)
-
class DevicesModel(object):
def __init__(self, **kargs):
@@ -390,87 +154,3 @@ class DeviceModel(object):
raise NotFoundError('KCHHOST0003E', {'name': nodedev_name})
return hostdev.get_dev_info(dev)
-
-class PackagesUpdateModel(object):
- def __init__(self, **kargs):
- try:
- self.host_swupdate = SoftwareUpdate()
- except:
- self.host_swupdate = None
-
- def get_list(self):
- if self.host_swupdate is None:
- raise OperationFailed('KCHPKGUPD0004E')
-
- return self.host_swupdate.getUpdates()
-
-
-class PackageUpdateModel(object):
- def __init__(self, **kargs):
- pass
-
- def lookup(self, name):
- try:
- swupdate = SoftwareUpdate()
- except Exception:
- raise OperationFailed('KCHPKGUPD0004E')
-
- return swupdate.getUpdate(name)
-
-
-class RepositoriesModel(object):
- def __init__(self, **kargs):
- try:
- self.host_repositories = Repositories()
- except:
- self.host_repositories = None
-
- def get_list(self):
- if self.host_repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return sorted(self.host_repositories.getRepositories())
-
- def create(self, params):
- if self.host_repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return self.host_repositories.addRepository(params)
-
-
-class RepositoryModel(object):
- def __init__(self, **kargs):
- try:
- self._repositories = Repositories()
- except:
- self._repositories = None
-
- def lookup(self, repo_id):
- if self._repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return self._repositories.getRepository(repo_id)
-
- def enable(self, repo_id):
- if self._repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return self._repositories.enableRepository(repo_id)
-
- def disable(self, repo_id):
- if self._repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return self._repositories.disableRepository(repo_id)
-
- def update(self, repo_id, params):
- if self._repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return self._repositories.updateRepository(repo_id, params)
-
- def delete(self, repo_id):
- if self._repositories is None:
- raise InvalidOperation('KCHREPOS0014E')
-
- return self._repositories.removeRepository(repo_id)
diff --git a/plugins/kimchi/repositories.py b/plugins/kimchi/repositories.py
deleted file mode 100644
index 9caabc4..0000000
--- a/plugins/kimchi/repositories.py
+++ /dev/null
@@ -1,529 +0,0 @@
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2014-2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import copy
-import os
-import time
-import urlparse
-from ConfigParser import ConfigParser
-
-from wok.basemodel import Singleton
-from wok.exception import InvalidOperation, InvalidParameter
-from wok.exception import OperationFailed, NotFoundError, MissingParameter
-from wok.utils import validate_repo_url
-
-from config import kimchiLock
-from yumparser import get_yum_repositories, write_repo_to_file
-
-
-class Repositories(object):
- __metaclass__ = Singleton
-
- """
- Class to represent and operate with repositories information.
- """
- def __init__(self):
- try:
- __import__('yum')
- self._pkg_mnger = YumRepo()
- except ImportError:
- try:
- __import__('apt_pkg')
- self._pkg_mnger = AptRepo()
- except ImportError:
- raise InvalidOperation('KCHREPOS0014E')
-
- def addRepository(self, params):
- """
- Add and enable a new repository
- """
- config = params.get('config', {})
- extra_keys = list(
- set(config.keys()).difference(set(self._pkg_mnger.CONFIG_ENTRY)))
- if len(extra_keys) > 0:
- raise InvalidParameter("KCHREPOS0028E",
- {'items': ",".join(extra_keys)})
-
- return self._pkg_mnger.addRepo(params)
-
- def getRepositories(self):
- """
- Return a dictionary with all Kimchi's repositories. Each element uses
- the format {<repo_id>: {repo}}, where repo is a dictionary in the
- repositories.Repositories() format.
- """
- return self._pkg_mnger.getRepositoriesList()
-
- def getRepository(self, repo_id):
- """
- Return a dictionary with all info from a given repository ID.
- """
- info = self._pkg_mnger.getRepo(repo_id)
- info['repo_id'] = repo_id
- return info
-
- def enableRepository(self, repo_id):
- """
- Enable a repository.
- """
- return self._pkg_mnger.toggleRepo(repo_id, True)
-
- def disableRepository(self, repo_id):
- """
- Disable a given repository.
- """
- return self._pkg_mnger.toggleRepo(repo_id, False)
-
- def updateRepository(self, repo_id, params):
- """
- Update the information of a given repository.
- The input is the repo_id of the repository to be updated and a dict
- with the information to be updated.
- """
- return self._pkg_mnger.updateRepo(repo_id, params)
-
- def removeRepository(self, repo_id):
- """
- Remove a given repository
- """
- return self._pkg_mnger.removeRepo(repo_id)
-
-
-class YumRepo(object):
- """
- Class to represent and operate with YUM repositories.
- It's loaded only on those systems listed at YUM_DISTROS and loads necessary
- modules in runtime.
- """
- TYPE = 'yum'
- DEFAULT_CONF_DIR = "/etc/yum.repos.d"
- CONFIG_ENTRY = ('repo_name', 'mirrorlist', 'metalink')
-
- def __init__(self):
- self._confdir = self.DEFAULT_CONF_DIR
-
- def _get_repos(self, errcode):
- try:
- kimchiLock.acquire()
- repos = get_yum_repositories()
- except Exception, e:
- kimchiLock.release()
- raise OperationFailed(errcode, {'err': str(e)})
- finally:
- kimchiLock.release()
-
- return repos
-
- def getRepositoriesList(self):
- """
- Return a list of repositories IDs
- """
- repos = self._get_repos('KCHREPOS0024E')
- return repos.keys()
-
- def getRepo(self, repo_id):
- """
- Return a dictionary in the repositories.Repositories() of the given
- repository ID format with the information of a YumRepository object.
- """
- repos = self._get_repos('KCHREPOS0025E')
-
- if repo_id not in repos.keys():
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- entry = repos.get(repo_id)
-
- info = {}
- info['enabled'] = entry.enabled
- info['baseurl'] = entry.baseurl or ''
- info['config'] = {}
- info['config']['repo_name'] = entry.name or ''
- info['config']['gpgcheck'] = entry.gpgcheck
- info['config']['gpgkey'] = entry.gpgkey or ''
- info['config']['mirrorlist'] = entry.mirrorlist or ''
- info['config']['metalink'] = entry.metalink or ''
- return info
-
- def addRepo(self, params):
- """
- Add a given repository to YumBase
- """
- # At least one base url, or one mirror, must be given.
- baseurl = params.get('baseurl', '')
-
- config = params.get('config', {})
- mirrorlist = config.get('mirrorlist', '')
- metalink = config.get('metalink', '')
- if not baseurl and not mirrorlist and not metalink:
- raise MissingParameter("KCHREPOS0013E")
-
- if baseurl:
- validate_repo_url(baseurl)
-
- if mirrorlist:
- validate_repo_url(mirrorlist)
-
- if metalink:
- validate_repo_url(metalink)
-
- if mirrorlist and metalink:
- raise InvalidOperation('KCHREPOS0030E')
-
- repo_id = params.get('repo_id', None)
- if repo_id is None:
- repo_id = "kimchi_repo_%s" % str(int(time.time() * 1000))
-
- repos = self._get_repos('KCHREPOS0026E')
- if repo_id in repos.keys():
- raise InvalidOperation("KCHREPOS0022E", {'repo_id': repo_id})
-
- repo_name = config.get('repo_name', repo_id)
- repo = {'baseurl': baseurl, 'mirrorlist': mirrorlist,
- 'name': repo_name, 'gpgcheck': 1,
- 'gpgkey': [], 'enabled': 1, 'metalink': metalink}
-
- # write a repo file in the system with repo{} information.
- parser = ConfigParser()
- parser.add_section(repo_id)
-
- for key, value in repo.iteritems():
- if value:
- parser.set(repo_id, key, value)
-
- repofile = os.path.join(self._confdir, repo_id + '.repo')
- try:
- with open(repofile, 'w') as fd:
- parser.write(fd)
- except:
- raise OperationFailed("KCHREPOS0018E",
- {'repo_file': repofile})
-
- return repo_id
-
- def toggleRepo(self, repo_id, enable):
- repos = self._get_repos('KCHREPOS0011E')
- if repo_id not in repos.keys():
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- entry = repos.get(repo_id)
- if enable and entry.enabled:
- raise InvalidOperation("KCHREPOS0015E", {'repo_id': repo_id})
-
- if not enable and not entry.enabled:
- raise InvalidOperation("KCHREPOS0016E", {'repo_id': repo_id})
-
- kimchiLock.acquire()
- try:
- if enable:
- entry.enable()
- else:
- entry.disable()
-
- write_repo_to_file(entry)
- except:
- if enable:
- raise OperationFailed("KCHREPOS0020E", {'repo_id': repo_id})
-
- raise OperationFailed("KCHREPOS0021E", {'repo_id': repo_id})
- finally:
- kimchiLock.release()
-
- return repo_id
-
- def updateRepo(self, repo_id, params):
- """
- Update a given repository in repositories.Repositories() format
- """
- repos = self._get_repos('KCHREPOS0011E')
- if repo_id not in repos.keys():
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- entry = repos.get(repo_id)
-
- baseurl = params.get('baseurl', None)
- config = params.get('config', {})
- mirrorlist = config.get('mirrorlist', None)
- metalink = config.get('metalink', None)
-
- if baseurl is not None and len(baseurl.strip()) == 0:
- baseurl = None
-
- if mirrorlist is not None and len(mirrorlist.strip()) == 0:
- mirrorlist = None
-
- if metalink is not None and len(metalink.strip()) == 0:
- metalink = None
-
- if baseurl is None and mirrorlist is None and metalink is None:
- raise MissingParameter("KCHREPOS0013E")
-
- if baseurl is not None:
- validate_repo_url(baseurl)
- entry.baseurl = baseurl
-
- if mirrorlist is not None:
- validate_repo_url(mirrorlist)
- entry.mirrorlist = mirrorlist
-
- if metalink is not None:
- validate_repo_url(metalink)
- entry.metalink = metalink
-
- if mirrorlist and metalink:
- raise InvalidOperation('KCHREPOS0030E')
-
- entry.id = params.get('repo_id', repo_id)
- entry.name = config.get('repo_name', entry.name)
- entry.gpgcheck = config.get('gpgcheck', entry.gpgcheck)
- entry.gpgkey = config.get('gpgkey', entry.gpgkey)
- kimchiLock.acquire()
- write_repo_to_file(entry)
- kimchiLock.release()
- return repo_id
-
- def removeRepo(self, repo_id):
- """
- Remove a given repository
- """
- repos = self._get_repos('KCHREPOS0027E')
- if repo_id not in repos.keys():
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- entry = repos.get(repo_id)
- parser = ConfigParser()
- with open(entry.repofile) as fd:
- parser.readfp(fd)
-
- if len(parser.sections()) == 1:
- os.remove(entry.repofile)
- return
-
- parser.remove_section(repo_id)
- with open(entry.repofile, "w") as fd:
- parser.write(fd)
-
-
-class AptRepo(object):
- """
- Class to represent and operate with YUM repositories.
- It's loaded only on those systems listed at YUM_DISTROS and loads necessary
- modules in runtime.
- """
- TYPE = 'deb'
- KIMCHI_LIST = "kimchi-source.list"
- CONFIG_ENTRY = ('dist', 'comps')
-
- def __init__(self):
- getattr(__import__('apt_pkg'), 'init_config')()
- getattr(__import__('apt_pkg'), 'init_system')()
- config = getattr(__import__('apt_pkg'), 'config')
- self.pkg_lock = getattr(__import__('apt_pkg'), 'SystemLock')
- module = __import__('aptsources.sourceslist', globals(), locals(),
- ['SourcesList'], -1)
-
- self._sourceparts_path = '/%s%s' % (
- config.get('Dir::Etc'), config.get('Dir::Etc::sourceparts'))
- self._sourceslist = getattr(module, 'SourcesList')
- self.filename = os.path.join(self._sourceparts_path, self.KIMCHI_LIST)
- if not os.path.exists(self.filename):
- with open(self.filename, 'w') as fd:
- fd.write("# This file is managed by Kimchi and it must not "
- "be modified manually\n")
-
- def _get_repos(self):
- try:
- with self.pkg_lock():
- repos = self._sourceslist()
- repos.refresh()
- except Exception, e:
- kimchiLock.release()
- raise OperationFailed('KCHREPOS0025E', {'err': e.message})
-
- return repos
-
- def _get_repo_id(self, repo):
- data = urlparse.urlparse(repo.uri)
- name = data.hostname or data.path
- return '%s-%s-%s' % (name, repo.dist, "-".join(repo.comps))
-
- def _get_source_entry(self, repo_id):
- kimchiLock.acquire()
- repos = self._get_repos()
- kimchiLock.release()
-
- for r in repos:
- # Ignore deb-src repositories
- if r.type != 'deb':
- continue
-
- if self._get_repo_id(r) != repo_id:
- continue
-
- return r
-
- return None
-
- def getRepositoriesList(self):
- """
- Return a list of repositories IDs
-
- APT repositories there aren't the concept about repository ID, so for
- internal control, the repository ID will be built as described in
- _get_repo_id()
- """
- kimchiLock.acquire()
- repos = self._get_repos()
- kimchiLock.release()
-
- res = []
- for r in repos:
- # Ignore deb-src repositories
- if r.type != 'deb':
- continue
-
- res.append(self._get_repo_id(r))
-
- return res
-
- def getRepo(self, repo_id):
- """
- Return a dictionary in the repositories.Repositories() format of the
- given repository ID with the information of a SourceEntry object.
- """
- r = self._get_source_entry(repo_id)
- if r is None:
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- info = {'enabled': not r.disabled,
- 'baseurl': r.uri,
- 'config': {'dist': r.dist,
- 'comps': r.comps}}
- return info
-
- def addRepo(self, params):
- """
- Add a new APT repository based on <params>
- """
- # To create a APT repository the dist is a required parameter
- # (in addition to baseurl, verified on controller through API.json)
- config = params.get('config', None)
- if config is None:
- raise MissingParameter("KCHREPOS0019E")
-
- if 'dist' not in config.keys():
- raise MissingParameter("KCHREPOS0019E")
-
- uri = params['baseurl']
- dist = config['dist']
- comps = config.get('comps', [])
-
- validate_repo_url(uri)
-
- kimchiLock.acquire()
- try:
- repos = self._get_repos()
- source_entry = repos.add('deb', uri, dist, comps,
- file=self.filename)
- with self.pkg_lock():
- repos.save()
- except Exception as e:
- kimchiLock.release()
- raise OperationFailed("KCHREPOS0026E", {'err': e.message})
- kimchiLock.release()
- return self._get_repo_id(source_entry)
-
- def toggleRepo(self, repo_id, enable):
- """
- Enable a given repository
- """
- r = self._get_source_entry(repo_id)
- if r is None:
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- if enable and not r.disabled:
- raise InvalidOperation("KCHREPOS0015E", {'repo_id': repo_id})
-
- if not enable and r.disabled:
- raise InvalidOperation("KCHREPOS0016E", {'repo_id': repo_id})
-
- if enable:
- line = 'deb'
- else:
- line = '#deb'
-
- kimchiLock.acquire()
- try:
- repos = self._get_repos()
- with self.pkg_lock():
- repos.remove(r)
- repos.add(line, r.uri, r.dist, r.comps, file=self.filename)
- repos.save()
- except:
- kimchiLock.release()
- if enable:
- raise OperationFailed("KCHREPOS0020E", {'repo_id': repo_id})
-
- raise OperationFailed("KCHREPOS0021E", {'repo_id': repo_id})
- finally:
- kimchiLock.release()
-
- return repo_id
-
- def updateRepo(self, repo_id, params):
- """
- Update a given repository in repositories.Repositories() format
- """
- old_info = self.getRepo(repo_id)
- updated_info = copy.deepcopy(old_info)
- updated_info['baseurl'] = params.get(
- 'baseurl', updated_info['baseurl'])
-
- if 'config' in params.keys():
- config = params['config']
- updated_info['config']['dist'] = config.get(
- 'dist', old_info['config']['dist'])
- updated_info['config']['comps'] = config.get(
- 'comps', old_info['config']['comps'])
-
- self.removeRepo(repo_id)
- try:
- return self.addRepo(updated_info)
- except:
- self.addRepo(old_info)
- raise
-
- def removeRepo(self, repo_id):
- """
- Remove a given repository
- """
- r = self._get_source_entry(repo_id)
- if r is None:
- raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
-
- kimchiLock.acquire()
- try:
- repos = self._get_repos()
- with self.pkg_lock():
- repos.remove(r)
- repos.save()
- except:
- kimchiLock.release()
- raise OperationFailed("KCHREPOS0017E", {'repo_id': repo_id})
- finally:
- kimchiLock.release()
diff --git a/plugins/kimchi/root.py b/plugins/kimchi/root.py
index 20c41ca..1e4cab7 100644
--- a/plugins/kimchi/root.py
+++ b/plugins/kimchi/root.py
@@ -58,7 +58,6 @@ class KimchiRoot(WokRoot):
make_dirs = [
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:
diff --git a/plugins/kimchi/swupdate.py b/plugins/kimchi/swupdate.py
deleted file mode 100644
index 84b927f..0000000
--- a/plugins/kimchi/swupdate.py
+++ /dev/null
@@ -1,263 +0,0 @@
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2014-2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import subprocess
-import time
-
-from wok.basemodel import Singleton
-from wok.exception import NotFoundError, OperationFailed
-from wok.utils import run_command, wok_log
-
-from config import kimchiLock
-from yumparser import get_yum_packages_list_update
-
-
-class SoftwareUpdate(object):
- __metaclass__ = Singleton
-
- """
- Class to represent and operate with OS software update.
- """
- def __init__(self):
- # This stores all packages to be updated for Kimchi perspective. It's a
- # dictionary of dictionaries, in the format {'package_name': package},
- # where:
- # package = {'package_name': <string>, 'version': <string>,
- # 'arch': <string>, 'repository': <string>
- # }
- self._packages = {}
-
- # This stores the number of packages to update
- self._num2update = 0
-
- # Get the distro of host machine and creates an object related to
- # correct package management system
- try:
- __import__('yum')
- wok_log.info("Loading YumUpdate features.")
- self._pkg_mnger = YumUpdate()
- except ImportError:
- try:
- __import__('apt')
- wok_log.info("Loading AptUpdate features.")
- self._pkg_mnger = AptUpdate()
- except ImportError:
- zypper_help = ["zypper", "--help"]
- (stdout, stderr, returncode) = run_command(zypper_help)
- if returncode == 0:
- wok_log.info("Loading ZypperUpdate features.")
- self._pkg_mnger = ZypperUpdate()
- else:
- raise Exception("There is no compatible package manager "
- "for this system.")
-
- def _scanUpdates(self):
- """
- Update self._packages with packages to be updated.
- """
- self._packages = {}
- self._num2update = 0
-
- # Call system pkg_mnger to get the packages as list of dictionaries.
- for pkg in self._pkg_mnger.getPackagesList():
-
- # Check if already exist a package in self._packages
- pkg_id = pkg.get('package_name')
- if pkg_id in self._packages.keys():
- # package already listed to update. do nothing
- continue
-
- # Update the self._packages and self._num2update
- self._packages[pkg_id] = pkg
- self._num2update = self._num2update + 1
-
- def getUpdates(self):
- """
- Return the self._packages.
- """
- self._scanUpdates()
- return self._packages
-
- def getUpdate(self, name):
- """
- Return a dictionary with all info from a given package name.
- """
- if name not in self._packages.keys():
- raise NotFoundError('KCHPKGUPD0002E', {'name': name})
-
- return self._packages[name]
-
- def getNumOfUpdates(self):
- """
- Return the number of packages to be updated.
- """
- self._scanUpdates()
- return self._num2update
-
- def doUpdate(self, cb, params):
- """
- Execute the update
- """
- # reset messages
- cb('')
-
- cmd = self._pkg_mnger.update_cmd
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- msgs = []
- while proc.poll() is None:
- msgs.append(proc.stdout.readline())
- cb(''.join(msgs))
- time.sleep(0.5)
-
- # read the final output lines
- msgs.extend(proc.stdout.readlines())
-
- retcode = proc.poll()
- if retcode == 0:
- return cb(''.join(msgs), True)
-
- msgs.extend(proc.stderr.readlines())
- return cb(''.join(msgs), False)
-
-
-class YumUpdate(object):
- """
- Class to represent and operate with YUM software update system.
- It's loaded only on those systems listed at YUM_DISTROS and loads necessary
- modules in runtime.
- """
- def __init__(self):
- self._pkgs = {}
- self.update_cmd = ["yum", "-y", "update"]
-
- def _refreshUpdateList(self):
- """
- Update the list of packages to be updated in the system.
- """
- try:
- kimchiLock.acquire()
- self._pkgs = get_yum_packages_list_update()
- except Exception, e:
- raise OperationFailed('KCHPKGUPD0003E', {'err': str(e)})
- finally:
- kimchiLock.release()
-
- def getPackagesList(self):
- """
- Return a list of package's dictionaries. Each dictionary contains the
- information about a package, in the format:
- package = {'package_name': <string>, 'version': <string>,
- 'arch': <string>, 'repository': <string>}
- """
- self._refreshUpdateList()
- pkg_list = []
- for pkg in self._pkgs:
- package = {'package_name': pkg.name, 'version': pkg.version,
- 'arch': pkg.arch, 'repository': pkg.ui_from_repo}
- pkg_list.append(package)
- return pkg_list
-
-
-class AptUpdate(object):
- """
- Class to represent and operate with APT software update system.
- It's loaded only on those systems listed at APT_DISTROS and loads necessary
- modules in runtime.
- """
- def __init__(self):
- self._pkgs = {}
- self.pkg_lock = getattr(__import__('apt_pkg'), 'SystemLock')
- self.update_cmd = ['apt-get', 'upgrade', '-y']
-
- def _refreshUpdateList(self):
- """
- Update the list of packages to be updated in the system.
- """
- apt_cache = getattr(__import__('apt'), 'Cache')()
- try:
- with self.pkg_lock():
- apt_cache.update()
- apt_cache.upgrade()
- self._pkgs = apt_cache.get_changes()
- except Exception, e:
- kimchiLock.release()
- raise OperationFailed('KCHPKGUPD0003E', {'err': e.message})
-
- def getPackagesList(self):
- """
- Return a list of package's dictionaries. Each dictionary contains the
- information about a package, in the format
- package = {'package_name': <string>, 'version': <string>,
- 'arch': <string>, 'repository': <string>}
- """
- kimchiLock.acquire()
- self._refreshUpdateList()
- kimchiLock.release()
- pkg_list = []
- for pkg in self._pkgs:
- package = {'package_name': pkg.shortname,
- 'version': pkg.candidate.version,
- 'arch': pkg._pkg.architecture,
- 'repository': pkg.candidate.origins[0].label}
- pkg_list.append(package)
-
- return pkg_list
-
-
-class ZypperUpdate(object):
- """
- Class to represent and operate with Zypper software update system.
- It's loaded only on those systems listed at ZYPPER_DISTROS and loads
- necessary modules in runtime.
- """
- def __init__(self):
- self._pkgs = {}
- self.update_cmd = ["zypper", "--non-interactive", "update",
- "--auto-agree-with-licenses"]
-
- def _refreshUpdateList(self):
- """
- Update the list of packages to be updated in the system.
- """
- self._pkgs = []
- cmd = ["zypper", "list-updates"]
- (stdout, stderr, returncode) = run_command(cmd)
-
- if len(stderr) > 0:
- raise OperationFailed('KCHPKGUPD0003E', {'err': stderr})
-
- for line in stdout.split('\n'):
- if line.find('v |') >= 0:
- info = line.split(' | ')
- package = {'package_name': info[2], 'version': info[4],
- 'arch': info[5], 'repository': info[1]}
- self._pkgs.append(package)
-
- def getPackagesList(self):
- """
- Return a list of package's dictionaries. Each dictionary contains the
- information about a package, in the format
- package = {'package_name': <string>, 'version': <string>,
- 'arch': <string>, 'repository': <string>}
- """
- kimchiLock.acquire()
- self._refreshUpdateList()
- kimchiLock.release()
- return self._pkgs
diff --git a/plugins/kimchi/tests/test_authorization.py b/plugins/kimchi/tests/test_authorization.py
index 53aa847..0976622 100644
--- a/plugins/kimchi/tests/test_authorization.py
+++ b/plugins/kimchi/tests/test_authorization.py
@@ -77,12 +77,6 @@ class AuthorizationTests(unittest.TestCase):
resp = self.request('/plugins/kimchi/host/shutdown', '{}', 'POST')
self.assertEquals(403, resp.status)
- # Non-root users can not get or debug reports
- resp = self.request('/plugins/kimchi/debugreports', '{}', 'GET')
- self.assertEquals(403, resp.status)
- resp = self.request('/plugins/kimchi/debugreports', '{}', 'POST')
- self.assertEquals(403, resp.status)
-
# Non-root users can not create or delete network (only get)
resp = self.request('/plugins/kimchi/networks', '{}', 'GET')
self.assertEquals(200, resp.status)
diff --git a/plugins/kimchi/tests/test_config.py.in b/plugins/kimchi/tests/test_config.py.in
index 6bca3df..c37069f 100644
--- a/plugins/kimchi/tests/test_config.py.in
+++ b/plugins/kimchi/tests/test_config.py.in
@@ -22,7 +22,6 @@ from cherrypy.lib.reprconf import Parser
from wok.config import Paths
-from wok.plugins.kimchi.config import get_debugreports_path
from wok.plugins.kimchi.config import get_screenshot_path
from wok.plugins.kimchi.config import KimchiPaths
@@ -167,13 +166,6 @@ class ConfigTests(unittest.TestCase):
'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.wokauth.on': True,
- 'tools.staticdir.content_types': {'xz': 'application/x-xz'}
- },
'/favicon.ico': {
'tools.staticfile.on': True,
'tools.staticfile.filename':
diff --git a/plugins/kimchi/tests/test_host.py b/plugins/kimchi/tests/test_host.py
deleted file mode 100644
index e2aa196..0000000
--- a/plugins/kimchi/tests/test_host.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import json
-import os
-import platform
-import psutil
-import tempfile
-import time
-import unittest
-from functools import partial
-
-from wok.plugins.kimchi.mockmodel import MockModel
-
-from utils import get_free_port, patch_auth, request, run_server, wait_task
-
-
-test_server = None
-model = None
-host = None
-ssl_port = None
-tmpfile = None
-
-
-def setUpModule():
- global test_server, model, host, ssl_port, tmpfile
-
- patch_auth()
- tmpfile = tempfile.mktemp()
- model = MockModel(tmpfile)
- host = '127.0.0.1'
- port = get_free_port('http')
- ssl_port = get_free_port('https')
- cherrypy_port = get_free_port('cherrypy_port')
- test_server = run_server(host, port, ssl_port, test_mode=True,
- cherrypy_port=cherrypy_port, model=model)
-
-
-def tearDownModule():
- test_server.stop()
- os.unlink(tmpfile)
-
-
-class HostTests(unittest.TestCase):
- def setUp(self):
- self.request = partial(request, host, ssl_port)
-
- def test_hostinfo(self):
- resp = self.request('/plugins/kimchi/host').read()
- info = json.loads(resp)
- keys = ['os_distro', 'os_version', 'os_codename', 'cpu_model',
- 'memory', 'cpus']
- self.assertEquals(sorted(keys), sorted(info.keys()))
-
- distro, version, codename = platform.linux_distribution()
- self.assertEquals(distro, info['os_distro'])
- self.assertEquals(version, info['os_version'])
- self.assertEquals(unicode(codename, "utf-8"), info['os_codename'])
- self.assertEquals(psutil.TOTAL_PHYMEM, info['memory'])
-
- def test_hoststats(self):
- time.sleep(1)
- stats_keys = ['cpu_utilization', 'memory', 'disk_read_rate',
- 'disk_write_rate', 'net_recv_rate', 'net_sent_rate']
- resp = self.request('/plugins/kimchi/host/stats').read()
- stats = json.loads(resp)
- self.assertEquals(sorted(stats_keys), sorted(stats.keys()))
-
- cpu_utilization = stats['cpu_utilization']
- self.assertIsInstance(cpu_utilization, float)
- self.assertGreaterEqual(cpu_utilization, 0.0)
- self.assertTrue(cpu_utilization <= 100.0)
-
- memory_stats = stats['memory']
- self.assertIn('total', memory_stats)
- self.assertIn('free', memory_stats)
- self.assertIn('cached', memory_stats)
- self.assertIn('buffers', memory_stats)
- self.assertIn('avail', memory_stats)
-
- resp = self.request('/plugins/kimchi/host/stats/history').read()
- history = json.loads(resp)
- self.assertEquals(sorted(stats_keys), sorted(history.keys()))
-
- def test_host_actions(self):
- def _task_lookup(taskid):
- return json.loads(self.request('/plugins/kimchi/tasks/%s' %
- taskid).read())
-
- resp = self.request('/plugins/kimchi/host/shutdown', '{}', 'POST')
- self.assertEquals(200, resp.status)
- resp = self.request('/plugins/kimchi/host/reboot', '{}', 'POST')
- self.assertEquals(200, resp.status)
-
- # Test system update
- resp = self.request('/plugins/kimchi/host/packagesupdate', None, 'GET')
- pkgs = json.loads(resp.read())
- self.assertEquals(3, len(pkgs))
-
- pkg_keys = ['package_name', 'repository', 'arch', 'version']
- for p in pkgs:
- name = p['package_name']
- resp = self.request('/plugins/kimchi/host/packagesupdate/' + name,
- None, 'GET')
- info = json.loads(resp.read())
- self.assertEquals(sorted(pkg_keys), sorted(info.keys()))
-
- resp = self.request('/plugins/kimchi/host/swupdate', '{}', 'POST')
- task = json.loads(resp.read())
- task_params = [u'id', u'message', u'status', u'target_uri']
- self.assertEquals(sorted(task_params), sorted(task.keys()))
-
- resp = self.request('/plugins/kimchi/tasks/' + task[u'id'], None, 'GET')
- task_info = json.loads(resp.read())
- self.assertEquals(task_info['status'], 'running')
- wait_task(_task_lookup, task_info['id'])
- resp = self.request('/plugins/kimchi/tasks/' + task[u'id'], None, 'GET')
- task_info = json.loads(resp.read())
- self.assertEquals(task_info['status'], 'finished')
- self.assertIn(u'All packages updated', task_info['message'])
- pkgs = model.packagesupdate_get_list()
- self.assertEquals(0, len(pkgs))
-
- def test_host_partitions(self):
- resp = self.request('/plugins/kimchi/host/partitions')
- self.assertEquals(200, resp.status)
- partitions = json.loads(resp.read())
-
- keys = ['name', 'path', 'type', 'fstype', 'size', 'mountpoint',
- 'available']
- for item in partitions:
- resp = self.request('/plugins/kimchi/host/partitions/%s' %
- item['name'])
- info = json.loads(resp.read())
- self.assertEquals(sorted(info.keys()), sorted(keys))
-
- def test_host_devices(self):
- def asset_devices_type(devices, dev_type):
- for dev in devices:
- self.assertEquals(dev['device_type'], dev_type)
-
- resp = self.request('/plugins/kimchi/host/devices?_cap=scsi_host')
- nodedevs = json.loads(resp.read())
- # Mockmodel brings 3 preconfigured scsi fc_host
- self.assertEquals(3, len(nodedevs))
-
- nodedev = json.loads(self.request(
- '/plugins/kimchi/host/devices/scsi_host2').read())
- # Mockmodel generates random wwpn and wwnn
- self.assertEquals('scsi_host2', nodedev['name'])
- self.assertEquals('fc_host', nodedev['adapter']['type'])
- self.assertEquals(16, len(nodedev['adapter']['wwpn']))
- self.assertEquals(16, len(nodedev['adapter']['wwnn']))
-
- devs = json.loads(self.request('/plugins/kimchi/host/devices').read())
- dev_names = [dev['name'] for dev in devs]
- for dev_type in ('pci', 'usb_device', 'scsi'):
- resp = self.request('/plugins/kimchi/host/devices?_cap=%s' %
- dev_type)
- devsByType = json.loads(resp.read())
- names = [dev['name'] for dev in devsByType]
- self.assertTrue(set(names) <= set(dev_names))
- asset_devices_type(devsByType, dev_type)
-
- resp = self.request('/plugins/kimchi/host/devices?_passthrough=true')
- passthru_devs = [dev['name'] for dev in json.loads(resp.read())]
- self.assertTrue(set(passthru_devs) <= set(dev_names))
-
- for dev_type in ('pci', 'usb_device', 'scsi'):
- resp = self.request(
- '/plugins/kimchi/host/devices?_cap=%s&_passthrough=true' %
- dev_type)
- filteredDevs = json.loads(resp.read())
- filteredNames = [dev['name'] for dev in filteredDevs]
- self.assertTrue(set(filteredNames) <= set(dev_names))
- asset_devices_type(filteredDevs, dev_type)
-
- for dev in passthru_devs:
- resp = self.request(
- '/plugins/kimchi/host/devices?_passthrough_affected_by=%s' %
- dev)
- affected_devs = [dev['name'] for dev in json.loads(resp.read())]
- self.assertTrue(set(affected_devs) <= set(dev_names))
diff --git a/plugins/kimchi/tests/test_model.py b/plugins/kimchi/tests/test_model.py
index c70e4fb..3e95b58 100644
--- a/plugins/kimchi/tests/test_model.py
+++ b/plugins/kimchi/tests/test_model.py
@@ -943,54 +943,6 @@ class ModelTests(unittest.TestCase):
self.assertTrue('kimchi-vm' in vms)
- @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
- def test_debug_reports(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
-
- if not inst.capabilities_lookup()['system_report_tool']:
- raise unittest.SkipTest("Without debug report tool")
-
- try:
- timeout = int(os.environ['TEST_REPORT_TIMEOUT'])
- except (ValueError, KeyError):
- timeout = 120
-
- namePrefix = 'unitTestReport'
- # sosreport always deletes unsual letters like '-' and '_' in the
- # generated report file name.
- uuidstr = str(uuid.uuid4()).translate(None, "-_")
- reportName = namePrefix + uuidstr
- try:
- inst.debugreport_delete(namePrefix + '*')
- except NotFoundError:
- pass
- with RollbackContext() as rollback:
- report_list = inst.debugreports_get_list()
- self.assertFalse(reportName in report_list)
- try:
- tmp_name = reportName + "_1"
- task = inst.debugreports_create({'name': reportName})
- rollback.prependDefer(inst.debugreport_delete, tmp_name)
- taskid = task['id']
- inst.task_wait(taskid, timeout)
- self.assertEquals('finished',
- inst.task_lookup(taskid)['status'],
- "It is not necessary an error. "
- "You may need to increase the "
- "timeout number by "
- "TEST_REPORT_TIMEOUT=200 "
- "./run_tests.sh test_model")
- report_list = inst.debugreports_get_list()
- self.assertTrue(reportName in report_list)
- name = inst.debugreport_update(reportName, {'name': tmp_name})
- self.assertEquals(name, tmp_name)
- report_list = inst.debugreports_get_list()
- self.assertTrue(tmp_name in report_list)
- except OperationFailed, e:
- if 'debugreport tool not found' not in e.message:
- raise e
-
def test_get_distros(self):
inst = model.Model('test:///default',
objstore_loc=self.tmp_store)
@@ -1029,195 +981,6 @@ class ModelTests(unittest.TestCase):
volumes = inst.storagevolumes_get_list(args['name'])
self.assertEquals(len(volumes), 2)
- def test_repository_create(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
-
- yum_repos = [{'repo_id': 'fedora-fake',
- 'baseurl': 'http://www.fedora.org'},
- {'repo_id': 'fedora-updates-fake',
- 'config':
- {'mirrorlist': 'http://www.fedoraproject.org'}}]
-
- deb_repos = [{'baseurl': 'http://archive.ubuntu.com/ubuntu/',
- 'config': {'dist': 'quantal'}},
- {'baseurl': 'http://archive.ubuntu.com/ubuntu/',
- 'config': {'dist': 'quantal', 'comps': ['main']}}]
-
- yum_invalid_repos = []
- deb_invalid_repos = []
-
- for url in invalid_repository_urls:
- wrong_baseurl = {'repo_id': 'wrong-id', 'baseurl': url}
- wrong_mirrorlist = {'repo_id': 'wrong-id',
- 'baseurl': 'www.example.com',
- 'config': {'mirrorlist': url}}
- wrong_config_item = {
- 'repo_id': 'wrong-id',
- 'baseurl': 'www.example.com',
- 'config': {
- 'gpgkey': 'file:///tmp/KEY-fedora-updates-fake-19'}}
-
- yum_invalid_repos.append(wrong_baseurl)
- yum_invalid_repos.append(wrong_mirrorlist)
- yum_invalid_repos.append(wrong_config_item)
-
- wrong_baseurl['config'] = {'dist': 'tasty'}
- wrong_config = {'baseurl': deb_repos[0]['baseurl'],
- 'config': {
- 'unsupported_item': "a_unsupported_item"}}
- deb_invalid_repos.append(wrong_baseurl)
- deb_invalid_repos.append(wrong_config)
-
- repo_type = inst.capabilities_lookup()['repo_mngt_tool']
- if repo_type == 'yum':
- test_repos = yum_repos
- invalid_repos = yum_invalid_repos
- elif repo_type == 'deb':
- test_repos = deb_repos
- invalid_repos = deb_invalid_repos
- else:
- # repository management tool was not recognized by Kimchi
- # skip test case
- return
-
- # create repositories with invalid data
- for repo in invalid_repos:
- self.assertRaises(InvalidParameter, inst.repositories_create, repo)
-
- for repo in test_repos:
- system_host_repos = len(inst.repositories_get_list())
- repo_id = inst.repositories_create(repo)
- host_repos = inst.repositories_get_list()
- self.assertEquals(system_host_repos + 1, len(host_repos))
-
- repo_info = inst.repository_lookup(repo_id)
- self.assertEquals(repo_id, repo_info['repo_id'])
- self.assertEquals(True, repo_info.get('enabled'))
- self.assertEquals(repo.get('baseurl', ''),
- repo_info.get('baseurl'))
-
- original_config = repo.get('config', {})
- config_info = repo_info.get('config', {})
-
- if repo_type == 'yum':
- self.assertEquals(original_config.get('mirrorlist', ''),
- config_info.get('mirrorlist', ''))
- self.assertEquals(True, config_info['gpgcheck'])
- else:
- self.assertEquals(original_config['dist'], config_info['dist'])
- self.assertEquals(original_config.get('comps', []),
- config_info.get('comps', []))
-
- inst.repository_delete(repo_id)
- self.assertRaises(NotFoundError, inst.repository_lookup, repo_id)
-
- self.assertRaises(NotFoundError, inst.repository_lookup, 'google')
-
- def test_repository_update(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
-
- yum_repo = {'repo_id': 'fedora-fake',
- 'baseurl': 'http://www.fedora.org'}
- yum_new_repo = {'baseurl': 'http://www.fedoraproject.org'}
-
- deb_repo = {'baseurl': 'http://archive.ubuntu.com/ubuntu/',
- 'config': {'dist': 'quantal'}}
- deb_new_repo = {'baseurl': 'http://br.archive.canonical.com/ubuntu/',
- 'config': {'dist': 'utopic'}}
-
- yum_invalid_repos = []
- deb_invalid_repos = []
-
- for url in invalid_repository_urls:
- wrong_baseurl = {'baseurl': url}
- wrong_mirrorlist = {'baseurl': 'www.example.com',
- 'config': {'mirrorlist': url}}
-
- yum_invalid_repos.append(wrong_baseurl)
- yum_invalid_repos.append(wrong_mirrorlist)
-
- wrong_baseurl['config'] = {'dist': 'tasty'}
- deb_invalid_repos.append(wrong_baseurl)
-
- repo_type = inst.capabilities_lookup()['repo_mngt_tool']
- if repo_type == 'yum':
- repo = yum_repo
- new_repo = yum_new_repo
- invalid_repos = yum_invalid_repos
- elif repo_type == 'deb':
- repo = deb_repo
- new_repo = deb_new_repo
- invalid_repos = deb_invalid_repos
- else:
- # repository management tool was not recognized by Kimchi
- # skip test case
- return
-
- system_host_repos = len(inst.repositories_get_list())
-
- with RollbackContext() as rollback:
- repo_id = inst.repositories_create(repo)
- rollback.prependDefer(inst.repository_delete, repo_id)
-
- host_repos = inst.repositories_get_list()
- self.assertEquals(system_host_repos + 1, len(host_repos))
-
- # update repositories with invalid data
- for tmp_repo in invalid_repos:
- self.assertRaises(InvalidParameter, inst.repository_update,
- repo_id, tmp_repo)
-
- new_repo_id = inst.repository_update(repo_id, new_repo)
- repo_info = inst.repository_lookup(new_repo_id)
-
- self.assertEquals(new_repo_id, repo_info['repo_id'])
- self.assertEquals(new_repo['baseurl'], repo_info['baseurl'])
- self.assertEquals(True, repo_info['enabled'])
- inst.repository_update(new_repo_id, repo)
-
- def test_repository_disable_enable(self):
- inst = model.Model('test:///default',
- objstore_loc=self.tmp_store)
-
- yum_repo = {'repo_id': 'fedora-fake',
- 'baseurl': 'http://www.fedora.org'}
- deb_repo = {'baseurl': 'http://archive.ubuntu.com/ubuntu/',
- 'config': {'dist': 'quantal'}}
-
- repo_type = inst.capabilities_lookup()['repo_mngt_tool']
- if repo_type == 'yum':
- repo = yum_repo
- elif repo_type == 'deb':
- repo = deb_repo
- else:
- # repository management tool was not recognized by Kimchi
- # skip test case
- return
-
- system_host_repos = len(inst.repositories_get_list())
-
- repo_id = inst.repositories_create(repo)
-
- host_repos = inst.repositories_get_list()
- self.assertEquals(system_host_repos + 1, len(host_repos))
-
- repo_info = inst.repository_lookup(repo_id)
- self.assertEquals(True, repo_info['enabled'])
-
- inst.repository_disable(repo_id)
- repo_info = inst.repository_lookup(repo_id)
- self.assertEquals(False, repo_info['enabled'])
-
- inst.repository_enable(repo_id)
- repo_info = inst.repository_lookup(repo_id)
- self.assertEquals(True, repo_info['enabled'])
-
- # remove files creates
- inst.repository_delete(repo_id)
-
-
class BaseModelTests(unittest.TestCase):
class FoosModel(object):
def __init__(self):
diff --git a/plugins/kimchi/tests/test_rest.py b/plugins/kimchi/tests/test_rest.py
index 1a1ae6c..75e4342 100644
--- a/plugins/kimchi/tests/test_rest.py
+++ b/plugins/kimchi/tests/test_rest.py
@@ -1127,53 +1127,6 @@ class RestTests(unittest.TestCase):
# Distro not found error
self.assertIn('KCHDISTRO0001E', distro.get('reason'))
- def test_debugreports(self):
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports')
- self.assertEquals(200, resp.status)
-
- def _report_delete(self, name):
- request(host, ssl_port, '/plugins/kimchi/debugreports/%s' % name, '{}', 'DELETE')
-
- def test_create_debugreport(self):
- req = json.dumps({'name': 'report1'})
- with RollbackContext() as rollback:
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports', req, 'POST')
- self.assertEquals(202, resp.status)
- task = json.loads(resp.read())
- # make sure the debugreport doesn't exist until the
- # the task is finished
- wait_task(self._task_lookup, task['id'])
- rollback.prependDefer(self._report_delete, 'report2')
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports/report1')
- debugreport = json.loads(resp.read())
- self.assertEquals("report1", debugreport['name'])
- self.assertEquals(200, resp.status)
- req = json.dumps({'name': 'report2'})
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports/report1',
- req, 'PUT')
- self.assertEquals(303, resp.status)
-
- def test_debugreport_download(self):
- req = json.dumps({'name': 'report1'})
- with RollbackContext() as rollback:
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports', req, 'POST')
- self.assertEquals(202, resp.status)
- task = json.loads(resp.read())
- # make sure the debugreport doesn't exist until the
- # the task is finished
- wait_task(self._task_lookup, task['id'], 20)
- rollback.prependDefer(self._report_delete, 'report1')
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports/report1')
- debugreport = json.loads(resp.read())
- self.assertEquals("report1", debugreport['name'])
- self.assertEquals(200, resp.status)
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports/report1/content')
- self.assertEquals(200, resp.status)
- resp = request(host, ssl_port, '/plugins/kimchi/debugreports/report1')
- debugre = json.loads(resp.read())
- resp = request(host, ssl_port, debugre['uri'])
- self.assertEquals(200, resp.status)
-
def test_repositories(self):
def verify_repo(t, res):
for field in ('repo_id', 'enabled', 'baseurl', 'config'):
diff --git a/plugins/kimchi/ui/config/tab-ext.xml b/plugins/kimchi/ui/config/tab-ext.xml
index ee88c88..48ec9ec 100644
--- a/plugins/kimchi/ui/config/tab-ext.xml
+++ b/plugins/kimchi/ui/config/tab-ext.xml
@@ -2,13 +2,6 @@
<tabs-ext>
<tab>
<access role="admin" mode="admin"/>
- <access role="user" mode="none"/>
-
- <title>Host</title>
- <path>plugins/kimchi/host.html</path>
- </tab>
- <tab>
- <access role="admin" mode="admin"/>
<access role="user" mode="byInstance"/>
<title>Guests</title>
diff --git a/plugins/kimchi/ui/css/theme-default/host.css b/plugins/kimchi/ui/css/theme-default/host.css
deleted file mode 100644
index a0cccb1..0000000
--- a/plugins/kimchi/ui/css/theme-default/host.css
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013-2014
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.host-panel {
- font-size: 12px;
- margin-bottom: 100px;
-}
-
-.host-panel .logo-container, .host-panel .info-container,
-.host-panel .section-label, .host-panel .section-value {
- display: inline-block;
- vertical-align: top;
-}
-
-.host-panel .section-label {
- display: inline-block;
- margin-right: 1em;
- vertical-align: top;
-}
-
-.host-panel .logo {
- background: url("plugins/kimchi/images/icon-vm.png") no-repeat left top;
- height: 128px;
- width: 128px;
-}
-
-.host-panel .hostname {
- text-decoration: underline;
-}
-
-.host-panel .action-panel {
- margin-top: 2em;
- padding-left: 10px;
-}
-
-.host-panel .button-icon {
- background: url("../images/theme-default/host-icon-sprite.png") no-repeat
- left top;
- display: inline-block;
- height: 12px;
- width: 12px;
-}
-
-.host-panel .action-icon-stop {
- background-position: -14px 0;
-}
-
-.host-panel .action-icon-restart {
- background-position: -28px 0;
-}
-
-.host-panel .action-icon-download {
- background-position: -42px 0;
-}
-
-.host-panel .action-icon-connect {
- background-position: -56px 0;
-}
-
-.host-panel .action-icon-add {
- background-position: -70px 0;
-}
-
-.host-panel .action-icon-edit {
- background-position: -84px 0;
-}
-
-.host-panel .action-icon-remove {
- background-position: -98px 0;
-}
-
-.host-panel button:disabled .action-icon-start {
- background-position: 0 -14px;
-}
-
-.host-panel button:disabled .action-icon-stop {
- background-position: -14px -14px;
-}
-
-.host-panel button:disabled .action-icon-restart {
- background-position: -28px -14px;
-}
-
-.host-panel button:disabled .action-icon-download {
- background-position: -42px -14px;
-}
-
-.host-panel button:disabled .action-icon-connect {
- background-position: -56px -14px;
-}
-
-.host-panel button:disabled .action-icon-add {
- background-position: -70px -14px;
-}
-
-.host-panel button:disabled .action-icon-edit {
- background-position: -84px -14px;
-}
-
-.host-panel button:disabled .action-icon-remove {
- background-position: -98px -14px;
-}
-
-.host-panel .info-container {
- padding-top: 16px;
- width: 890px;
-}
-
-.host-panel .section-header {
- background: #EEE;
- border-radius: 5px;
- cursor: pointer;
- line-height: 2em;
- margin: 1em 0 1em;
- padding-left: 6px;
-}
-
-.host-panel .section-header:hover {
- background: #06f;
- color: white;
-}
-
-.host-panel .section-content {
- padding-left: 1em;
-}
-
-.host-panel .section-header .arrow {
- border-color: transparent;
- border-style: solid;
- display: inline-block;
- margin-right: 6px;
- width: 0;
-}
-
-.host-panel .section-header[aria-expanded="true"] .arrow {
- border-top-color: black;
- border-width: 8px 4px 0;
- border-bottom: none;
-}
-
-.host-panel .section-header[aria-expanded="true"]:hover .arrow {
- border-top-color: white;
-}
-
-.host-panel .section-header[aria-expanded="false"] .arrow {
- border-left-color: black;
- border-right: none;
- border-width: 4px 0 4px 8px;
-}
-
-.host-panel .section-header[aria-expanded="false"]:hover .arrow {
- border-left-color: white;
-}
-
-.host-panel .section-row {
- line-height: 1.6em;
- margin-bottom: 1em;
-}
-
-.host-panel .section-label {
- width: 100px;
-}
-
-#frequency-textbox {
- width: 20px;
-}
-
-#container-chart-cpu,
-#container-chart-memory,
-#container-chart-disk-io,
-#container-chart-network-io {
- border: 1px solid white;
- box-shadow: 2px 2px 2px gray, 2px -2px 2px gray, -2px -2px 2px gray, -2px
- 2px 2px gray;
- height: 100px;
- width: 500px;
-}
-
-#container-chart-disk-io .disk-write,
-#container-chart-network-io .network-sent {
- stroke: #f80;
-}
-
-/* Debug Report */
-.cell-text-wrapper {
- margin-left: 10px;
-}
-
-.host-panel #available-reports-grid {
- border-color: #ddd;
- height: 400px;
- width: 850px;
-}
-
-.host-panel select#available-reports-list {
- width: 300px;
-}
-
-.host-panel select#available-reports-list option {
- margin: .2em 1em;
-}
-
-.debug-report-name,
-.debug-report-time {
- width: 424px;
-}
-
-#id-debug-img {
- background: url(../images/theme-default/kimchi-loading15x15.gif) 12px
- center no-repeat;
- padding-left: 23px;
-}
-
-/* End of Debug Report */
-
-/* Software Updates */
-.host-panel #software-updates-grid {
- border-color: #ddd;
- height: 300px;
- width: 850px;
-}
-
-.software-update-name,
-.software-update-repos {
- width: 224px;
-}
-
-.software-update-version,
-.software-update-arch {
- width: 200px;
-}
-
-.host-panel #software-updates-progress-textarea {
- border: 1px solid #ddd;
- box-sizing: border-box;
- height: 100px;
- padding: .2em .5em;
- resize: vertical;
- width: 852px;
-}
-/* End of Software Updates */
-
-/* Repository */
-.host-panel #repositories-grid {
- border-color: #ddd;
- height: 200px;
- width: 850px;
-}
-
-.host-panel #repositories-grid .repository-id {
- width: 120px;
-}
-
-.host-panel #repositories-grid .repository-name {
- width: 640px;
-}
-
-.host-panel #repositories-grid .repository-enabled {
- width: 88px;
-}
-
-.host-panel #repositories-grid .repository-baseurl.deb {
- width: 400px;
-}
-
-.host-panel #repositories-grid .repository-enabled.deb {
- width: 100px;
-}
-
-.host-panel #repositories-grid .repository-gpgcheck.deb {
- width: 150px;
-}
-/* End of Repository */
diff --git a/plugins/kimchi/ui/css/theme-default/report-add.css b/plugins/kimchi/ui/css/theme-default/report-add.css
deleted file mode 100644
index 8020182..0000000
--- a/plugins/kimchi/ui/css/theme-default/report-add.css
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#report-add-window {
- height: 300px;
- width: 400px;
-}
-
-#report-add-window .field {
- font-size: 12px;
-}
-
-#report-name-textbox {
- margin: 0;
- width: 100%;
-}
-
-.info-add-debug-report {
- font-size: 12px;
- color: #999999;
- font-weight: lighter;
- font-family: 'Helvetica Neue', Helvetica, Arial;
-}
\ No newline at end of file
diff --git a/plugins/kimchi/ui/css/theme-default/report-rename.css b/plugins/kimchi/ui/css/theme-default/report-rename.css
deleted file mode 100644
index 2fb2698..0000000
--- a/plugins/kimchi/ui/css/theme-default/report-rename.css
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#report-rename-window {
- height: 300px;
- width: 400px;
-}
-
-#report-rename-window .field {
- font-size: 12px;
-}
-
-#report-name-textbox {
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- margin: 0;
- width: 100%;
-}
-
-.info-debug-report-rename {
- font-size: 12px;
- color: #999999;
- font-weight: lighter;
- font-family: 'Helvetica Neue', Helvetica, Arial;
-}
diff --git a/plugins/kimchi/ui/css/theme-default/repository-add.css b/plugins/kimchi/ui/css/theme-default/repository-add.css
deleted file mode 100644
index 4344569..0000000
--- a/plugins/kimchi/ui/css/theme-default/repository-add.css
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#repository-add-window {
- height: 500px;
- width: 1000px;
-}
-
-#repository-add-window span.required {
- color: red;
- padding-left: 5px;
- vertical-align: top;
-}
-
-#repository-add-window .textbox-wrapper input[type="text"] {
- box-sizing: border-box;
- width: 100%;
-}
-
-#repository-add-window .textbox-wrapper label {
- vertical-align: middle;
-}
-
-#isMirrorLabel {
- font-size: 14px;
- font-weight: lighter;
- font-family: 'Helvetica Neue', Helvetica, Arial;
-}
\ No newline at end of file
diff --git a/plugins/kimchi/ui/css/theme-default/repository-edit.css b/plugins/kimchi/ui/css/theme-default/repository-edit.css
deleted file mode 100644
index 383a7fe..0000000
--- a/plugins/kimchi/ui/css/theme-default/repository-edit.css
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.yum div#repository-edit-window {
- height: 680px;
- width: 1000px;
-}
-
-.deb div#repository-edit-window {
- height: 480px;
- width: 1000px;
-}
-
-
-.repository-edit-fieldset {
- float: left;
- padding: 0 30px;
- width: 95%;
-}
-
-.repository-edit-wrapper-label, .repository-edit-wrapper-controls {
- display: inline-block;
- height: 30px;
- line-height: 30px;
- font-size: 14px;
- vertical-align: top;
-}
-
-.repository-edit-wrapper-label {
- margin-top: 10px;
- width: 150px;
-}
-
-.repository-edit-wrapper-controls label {
- vertical-align: middle;
-}
-
-.repository-edit-wrapper-controls {
- width: 100%;
-}
-
-.repository-edit-wrapper-controls input[type="text"] {
- font-size: 16px;
- height: 30px;
- line-height: 30px;
- padding: 0 10px;
- width: 100%;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- border: 1px solid #CCCCCC;
-}
-
-
-.repository-edit-wrapper-controls input[type="text"][readonly] {
- color: #bbb;
- background-color: #fafafa;
-}
-
-
-.repository-edit-wrapper-controls input[type="text"][disabled] {
- color: #bbb;
- background-color: #fafafa;
- cursor: not-allowed;
-}
-
-
-.deb .yum{
- display: none;
-}
-
-
-.yum .deb{
- display: none;
-}
diff --git a/plugins/kimchi/ui/js/src/kimchi.api.js b/plugins/kimchi/ui/js/src/kimchi.api.js
index 0ec3747..19fe1a6 100644
--- a/plugins/kimchi/ui/js/src/kimchi.api.js
+++ b/plugins/kimchi/ui/js/src/kimchi.api.js
@@ -70,37 +70,6 @@ var kimchi = {
},
/**
- * Get the dynamic host stats (usually used for monitoring).
- */
- getHostStats : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/host/stats',
- type : 'GET',
- contentType : 'application/json',
- headers: {'Wok-Robot': 'wok-robot'},
- dataType : 'json',
- success : suc,
- error: err
- });
- },
-
- /**
- * Get the historic host stats.
- */
- getHostStatsHistory : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/host/stats/history',
- type : 'GET',
- resend: true,
- contentType : 'application/json',
- headers: {'Wok-Robot': 'wok-robot'},
- dataType : 'json',
- success : suc,
- error: err
- });
- },
-
- /**
*
* Create a new Virtual Machine. Usage: kimchi.createVM({ name: 'MyUbuntu',
* template: '/templates/ubuntu_base' }, creationSuc, creationErr);
@@ -638,18 +607,6 @@ var kimchi = {
});
},
- listReports : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/debugreports',
- type : 'GET',
- contentType : 'application/json',
- dataType : 'json',
- resend: true,
- success : suc,
- error : err
- });
- },
-
trackTask : function(taskID, suc, err, progress) {
var onTaskResponse = function(result) {
var taskStatus = result['status'];
@@ -676,75 +633,6 @@ var kimchi = {
kimchi.trackingTasks.push(taskID);
},
- createReport: function(settings, suc, err, progress) {
- var onResponse = function(data) {
- taskID = data['id'];
- kimchi.trackTask(taskID, suc, err, progress);
- };
-
- wok.requestJSON({
- url : 'plugins/kimchi/debugreports',
- type : "POST",
- contentType : "application/json",
- data : JSON.stringify(settings),
- dataType : "json",
- success : onResponse,
- error : err
- });
- },
-
- renameReport : function(name, settings, suc, err) {
- $.ajax({
- url : "plugins/kimchi/debugreports/" + encodeURIComponent(name),
- type : 'PUT',
- contentType : 'application/json',
- data : JSON.stringify(settings),
- dataType : 'json',
- success: suc,
- error: err
- });
- },
-
- deleteReport: function(settings, suc, err) {
- var reportName = encodeURIComponent(settings['name']);
- wok.requestJSON({
- url : 'plugins/kimchi/debugreports/' + reportName,
- type : 'DELETE',
- contentType : 'application/json',
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
- downloadReport: function(settings, suc, err) {
- window.open(settings['file']);
- },
-
- shutdown: function(settings, suc, err) {
- var reboot = settings && settings['reboot'] === true;
- var url = 'plugins/kimchi/host/' + (reboot ? 'reboot' : 'shutdown');
- wok.requestJSON({
- url : url,
- type : 'POST',
- contentType : 'application/json',
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
- listHostPartitions : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/host/partitions',
- type : 'GET',
- contentType : 'application/json',
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
getStorageServers: function(type, suc, err) {
var url = 'plugins/kimchi/storageservers?_target_type=' + type;
wok.requestJSON({
@@ -872,131 +760,6 @@ var kimchi = {
});
},
- listSoftwareUpdates : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/host/packagesupdate',
- type : 'GET',
- contentType : 'application/json',
- dataType : 'json',
- resend: true,
- success : suc,
- error : err
- });
- },
-
- updateSoftware : function(suc, err, progress) {
- var taskID = -1;
- var onResponse = function(data) {
- taskID = data['id'];
- trackTask();
- };
-
- var trackTask = function() {
- kimchi.getTask(taskID, onTaskResponse, err);
- };
-
- var onTaskResponse = function(result) {
- var taskStatus = result['status'];
- switch(taskStatus) {
- case 'running':
- progress && progress(result);
- setTimeout(function() {
- trackTask();
- }, 200);
- break;
- case 'finished':
- case 'failed':
- suc(result);
- break;
- default:
- break;
- }
- };
-
- wok.requestJSON({
- url : 'plugins/kimchi/host/swupdate',
- type : "POST",
- contentType : "application/json",
- dataType : "json",
- success : onResponse,
- error : err
- });
- },
-
- createRepository : function(settings, suc, err) {
- wok.requestJSON({
- url : "plugins/kimchi/host/repositories",
- type : "POST",
- contentType : "application/json",
- data : JSON.stringify(settings),
- dataType : "json",
- success: suc,
- error: err
- });
- },
-
- retrieveRepository : function(repository, suc, err) {
- var reposID = encodeURIComponent(repository);
- wok.requestJSON({
- url : "plugins/kimchi/host/repositories/" + reposID,
- type : 'GET',
- contentType : 'application/json',
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
- updateRepository : function(name, settings, suc, err) {
- var reposID = encodeURIComponent(name);
- $.ajax({
- url : "plugins/kimchi/host/repositories/" + reposID,
- type : 'PUT',
- contentType : 'application/json',
- data : JSON.stringify(settings),
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
- enableRepository : function(name, enable, suc, err) {
- var reposID = encodeURIComponent(name);
- $.ajax({
- url : "plugins/kimchi/host/repositories/" + reposID +
- '/' + (enable === true ? 'enable' : 'disable'),
- type : 'POST',
- contentType : 'application/json',
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
- deleteRepository : function(repository, suc, err) {
- var reposID = encodeURIComponent(repository);
- wok.requestJSON({
- url : 'plugins/kimchi/host/repositories/' + reposID,
- type : 'DELETE',
- contentType : 'application/json',
- dataType : 'json',
- success : suc,
- error : err
- });
- },
-
- listRepositories : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/host/repositories',
- type : 'GET',
- contentType : 'application/json',
- dataType : 'json',
- resend: true,
- success : suc,
- error : err
- });
- },
-
getHostFCDevices: function(suc, err) {
var url = 'plugins/kimchi/host/devices?_cap=fc_host';
wok.requestJSON({
@@ -1339,17 +1102,4 @@ var kimchi = {
});
},
- getCPUInfo : function(suc, err) {
- wok.requestJSON({
- url : 'plugins/kimchi/host/cpuinfo',
- type : 'GET',
- contentType : 'application/json',
- dataType : 'json',
- resend : true,
- success : suc,
- error : err ? err : function(data) {
- wok.message.error(data.responseJSON.reason);
- }
- });
- }
};
diff --git a/plugins/kimchi/ui/js/src/kimchi.host.js b/plugins/kimchi/ui/js/src/kimchi.host.js
deleted file mode 100644
index ab02333..0000000
--- a/plugins/kimchi/ui/js/src/kimchi.host.js
+++ /dev/null
@@ -1,858 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013-2014
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-kimchi.host={};
-
-kimchi.host_main = function() {
- var expand = function(header, toExpand) {
- var controlledNode = $(header).attr('aria-controls');
- $('#' + controlledNode)[toExpand ? 'removeClass' : 'addClass']('hidden');
- $(header).attr('aria-expanded', toExpand ? 'true' : 'false');
- };
-
- var repositoriesGrid = null;
- var initRepositoriesGrid = function(repo_type) {
- var gridFields=[];
- if (repo_type == "yum") {
- gridFields=[{
- name: 'repo_id',
- label: i18n['KCHREPO6004M'],
- 'class': 'repository-id'
- }, {
- name: 'config[repo_name]',
- label: i18n['KCHREPO6005M'],
- 'class': 'repository-name'
- }, {
- name: 'enabled',
- label: i18n['KCHREPO6009M'],
- 'class': 'repository-enabled'
- }];
- }
- else if (repo_type == "deb") {
- gridFields=[{
- name: 'baseurl',
- label: i18n['KCHREPO6006M'],
- makeTitle: true,
- 'class': 'repository-baseurl deb'
- }, {
- name: 'enabled',
- label: i18n['KCHREPO6009M'],
- 'class': 'repository-enabled deb'
- }, {
- name: 'config[dist]',
- label: "dist",
- 'class': 'repository-gpgcheck deb'
- }, {
- name: 'config[comps]',
- label: "comps",
- 'class': 'repository-gpgcheck deb'
- }];
- }
- else {
- gridFields=[{
- name: 'repo_id',
- label: i18n['KCHREPO6004M'],
- 'class': 'repository-id'
- }, {
- name: 'enabled',
- label: i18n['KCHREPO6009M'],
- 'class': 'repository-enabled'
- }, {
- name: 'baseurl',
- label: i18n['KCHREPO6006M'],
- makeTitle: true,
- 'class': 'repository-baseurl'
- }];
- }
- repositoriesGrid = new kimchi.widget.Grid({
- container: 'repositories-grid-container',
- id: 'repositories-grid',
- title: i18n['KCHREPO6003M'],
- toolbarButtons: [{
- id: 'repositories-grid-add-button',
- label: i18n['KCHREPO6012M'],
- onClick: function(event) {
- wok.window.open({url:'plugins/kimchi/repository-add.html',
- class: repo_type});
- }
- }, {
- id: 'repositories-grid-enable-button',
- label: i18n['KCHREPO6016M'],
- disabled: true,
- onClick: function(event) {
- var repository = repositoriesGrid.getSelected();
- if(!repository) {
- return;
- }
- var name = repository['repo_id'];
- var enable = !repository['enabled'];
- $(this).prop('disabled', true);
- kimchi.enableRepository(name, enable, function() {
- wok.topic('kimchi/repositoryUpdated').publish();
- });
- }
- }, {
- id: 'repositories-grid-edit-button',
- label: i18n['KCHREPO6013M'],
- disabled: true,
- onClick: function(event) {
- var repository = repositoriesGrid.getSelected();
- if(!repository) {
- return;
- }
- kimchi.selectedRepository = repository['repo_id'];
- wok.window.open({url:'plugins/kimchi/repository-edit.html',
- class: repo_type});
- }
- }, {
- id: 'repositories-grid-remove-button',
- label: i18n['KCHREPO6014M'],
- disabled: true,
- onClick: function(event) {
- var repository = repositoriesGrid.getSelected();
- if(!repository) {
- return;
- }
-
- var settings = {
- title : i18n['KCHREPO6001M'],
- content : i18n['KCHREPO6002M'],
- confirm : i18n['KCHAPI6004M'],
- cancel : i18n['KCHAPI6003M']
- };
-
- wok.confirm(settings, function() {
- kimchi.deleteRepository(
- repository['repo_id'],
- function(result) {
- wok.topic('kimchi/repositoryDeleted').publish(result);
- }, function(error) {
- }
- );
- });
- }
- }],
- onRowSelected: function(row) {
- var repository = repositoriesGrid.getSelected();
- if(!repository) {
- return;
- }
- $('#repositories-grid-remove-button').prop('disabled', false);
- $('#repositories-grid-edit-button').prop('disabled', false);
- var enabled = repository['enabled'];
- $('#repositories-grid-enable-button')
- .text(i18n[enabled ? 'KCHREPO6017M' : 'KCHREPO6016M'])
- .prop('disabled', false);
- },
- frozenFields: [],
- fields: gridFields,
- data: listRepositories
- });
- };
-
- var listRepositories = function(gridCallback) {
- kimchi.listRepositories(function(repositories) {
- if($.isFunction(gridCallback)) {
- gridCallback(repositories);
- }
- else {
- if(repositoriesGrid) {
- repositoriesGrid.setData(repositories);
- }
- else {
- initRepositoriesGrid();
- repositoriesGrid.setData(repositories);
- }
- }
- },
- function(error) {
- var message = error && error['responseJSON'] && error['responseJSON']['reason'];
-
- if($.isFunction(gridCallback)) {
- gridCallback([]);
- }
- repositoriesGrid &&
- repositoriesGrid.showMessage(message || i18n['KCHUPD6008M']);
- });
-
- $('#repositories-grid-remove-button').prop('disabled', true);
- $('#repositories-grid-edit-button').prop('disabled', true);
- $('#repositories-grid-enable-button').prop('disabled', true);
- };
-
- var softwareUpdatesGridID = 'software-updates-grid';
- var softwareUpdatesGrid = null;
- var progressAreaID = 'software-updates-progress-textarea';
- var reloadProgressArea = function(result) {
- var progressArea = $('#' + progressAreaID)[0];
- $(progressArea).text(result['message']);
- var scrollTop = $(progressArea).prop('scrollHeight');
- $(progressArea).prop('scrollTop', scrollTop);
- };
-
- var initSoftwareUpdatesGrid = function(softwareUpdates) {
- softwareUpdatesGrid = new kimchi.widget.Grid({
- container: 'software-updates-grid-container',
- id: softwareUpdatesGridID,
- title: i18n['KCHUPD6001M'],
- rowSelection: 'disabled',
- toolbarButtons: [{
- id: softwareUpdatesGridID + '-update-button',
- label: i18n['KCHUPD6006M'],
- disabled: true,
- onClick: function(event) {
- var updateButton = $(this);
- var progressArea = $('#' + progressAreaID)[0];
- $('#software-updates-progress-container').removeClass('hidden');
- $(progressArea).text('');
- !wok.isElementInViewport(progressArea) &&
- progressArea.scrollIntoView();
- $(updateButton).text(i18n['KCHUPD6007M']).prop('disabled', true);
-
- kimchi.updateSoftware(function(result) {
- reloadProgressArea(result);
- $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
- wok.topic('kimchi/softwareUpdated').publish({
- result: result
- });
- }, function(error) {
- var message = error && error['responseJSON'] && error['responseJSON']['reason'];
- wok.message.error(message || i18n['KCHUPD6009M']);
- $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
- }, reloadProgressArea);
- }
- }],
- frozenFields: [],
- fields: [{
- name: 'package_name',
- label: i18n['KCHUPD6002M'],
- 'class': 'software-update-name'
- }, {
- name: 'version',
- label: i18n['KCHUPD6003M'],
- 'class': 'software-update-version'
- }, {
- name: 'arch',
- label: i18n['KCHUPD6004M'],
- 'class': 'software-update-arch'
- }, {
- name: 'repository',
- label: i18n['KCHUPD6005M'],
- 'class': 'software-update-repos'
- }],
- data: listSoftwareUpdates
- });
- };
-
- var listSoftwareUpdates = function(gridCallback) {
- kimchi.listSoftwareUpdates(function(softwareUpdates) {
- if($.isFunction(gridCallback)) {
- gridCallback(softwareUpdates);
- }
- else {
- if(softwareUpdatesGrid) {
- softwareUpdatesGrid.setData(softwareUpdates);
- }
- else {
- initSoftwareUpdatesGrid(softwareUpdates);
- }
- }
-
- var updateButton = $('#' + softwareUpdatesGridID + '-update-button');
- $(updateButton).prop('disabled', softwareUpdates.length === 0);
- }, function(error) {
- var message = error && error['responseJSON'] && error['responseJSON']['reason'];
- if($.isFunction(gridCallback)) {
- gridCallback([]);
- }
- softwareUpdatesGrid &&
- softwareUpdatesGrid.showMessage(message || i18n['KCHUPD6008M']);
- });
- };
-
- var reportGridID = 'available-reports-grid';
- var reportGrid = null;
- var enableReportButtons = function(toEnable) {
- var buttonID = '#{grid}-{btn}-button';
- $.each(['rename', 'remove', 'download'], function(i, n) {
- $(wok.substitute(buttonID, {
- grid: reportGridID,
- btn: n
- })).prop('disabled', !toEnable);
- });
- };
- var initReportGrid = function(reports) {
- reportGrid = new kimchi.widget.Grid({
- container: 'available-reports-grid-container',
- id: reportGridID,
- title: i18n['KCHDR6002M'],
- toolbarButtons: [{
- id: reportGridID + '-generate-button',
- label: i18n['KCHDR6006M'],
- onClick: function(event) {
- wok.window.open('plugins/kimchi/report-add.html');
- }
- }, {
- id: reportGridID + '-rename-button',
- label: i18n['KCHDR6008M'],
- disabled: true,
- onClick: function(event) {
- var report = reportGrid.getSelected();
- if(!report) {
- return;
- }
-
- kimchi.selectedReport = report['name'];
- wok.window.open('plugins/kimchi/report-rename.html');
- }
- }, {
- id: reportGridID + '-remove-button',
- label: i18n['KCHDR6009M'],
- disabled: true,
- onClick: function(event) {
- var report = reportGrid.getSelected();
- if(!report) {
- return;
- }
-
- var settings = {
- title : i18n['KCHAPI6004M'],
- content : i18n['KCHDR6001M'],
- confirm : i18n['KCHAPI6002M'],
- cancel : i18n['KCHAPI6003M']
- };
-
- wok.confirm(settings, function() {
- kimchi.deleteReport({
- name: report['name']
- }, function(result) {
- listDebugReports();
- }, function(error) {
- wok.message.error(error.responseJSON.reason);
- });
- });
- }
- }, {
- id: reportGridID + '-download-button',
- label: i18n['KCHDR6010M'],
- disabled: true,
- onClick: function(event) {
- var report = reportGrid.getSelected();
- if(!report) {
- return;
- }
-
- kimchi.downloadReport({
- file: report['uri']
- });
- }
- }],
- onRowSelected: function(row) {
- var report = reportGrid.getSelected();
- // Only enable report buttons if the selected line is not a
- // pending report
- if (report['time'] == i18n['KCHDR6007M']) {
- var gridElement = $('#'+ reportGridID);
- var row = $('tr:contains(' + report['name'] + ')', gridElement);
- enableReportButtons(false);
- row.attr('class', '');
- }
- else {
- enableReportButtons(true);
- }
- },
- frozenFields: [],
- fields: [{
- name: 'name',
- label: i18n['KCHDR6003M'],
- 'class': 'debug-report-name'
- }, {
- name: 'time',
- label: i18n['KCHDR6005M'],
- 'class': 'debug-report-time'
- }],
- data: reports
- });
- };
-
- var getPendingReports = function() {
- var reports = []
- var filter = 'status=running&target_uri=' + encodeURIComponent('^/plugins/kimchi/debugreports/*')
-
- kimchi.getTasksByFilter(filter, function(tasks) {
- for(var i = 0; i < tasks.length; i++) {
- reportName = tasks[i].target_uri.replace(/^\/plugins\/kimchi\/debugreports\//, '') || i18n['KCHDR6012M'];
- reports.push({'name': reportName, 'time': i18n['KCHDR6007M']})
-
- if(kimchi.trackingTasks.indexOf(tasks[i].id) >= 0) {
- continue;
- }
-
- kimchi.trackTask(tasks[i].id, function(result) {
- wok.topic('kimchi/debugReportAdded').publish();
- }, function(result) {
- // Error message from Async Task status
- if (result['message']) {
- var errText = result['message'];
- }
- // Error message from standard kimchi exception
- else {
- var errText = result['responseJSON']['reason'];
- }
- result && wok.message.error(errText);
- wok.topic('kimchi/debugReportAdded').publish();
- }, null);
- }
- }, null, true);
-
- return reports;
- };
-
- var listDebugReports = function() {
- kimchi.listReports(function(reports) {
- pendingReports = getPendingReports();
- allReports = pendingReports.concat(reports);
- $('#debug-report-section').removeClass('hidden');
-
- // Row selection will be cleared so disable buttons here
- enableReportButtons(false);
-
- if(reportGrid) {
- reportGrid.setData(allReports);
- }
- else {
- initReportGrid(allReports);
- }
-
- // Set id-debug-img to pending reports
- // It will display a loading icon
- var gridElement = $('#' + reportGridID);
- $.each($('td:contains(' + i18n['KCHDR6007M'] + ')', gridElement), function(index, row) {
- $(row).parent().addClass('no-hover');
- $(row).attr('id', 'id-debug-img');
- });
- }, function(error) {
- if(error['status'] == 403) {
- $('#debug-report-section').addClass('hidden');
- return;
- }
- $('#debug-report-section').removeClass('hidden');
- });
- };
-
- var shutdownButtonID = '#host-button-shutdown';
- var restartButtonID = '#host-button-restart';
- var shutdownHost = function(params) {
- var settings = {
- title : i18n['KCHAPI6004M'],
- content : i18n['KCHHOST6008M'],
- confirm : i18n['KCHAPI6002M'],
- cancel : i18n['KCHAPI6003M']
- };
-
- wok.confirm(settings, function() {
- kimchi.shutdown(params);
- $(shutdownButtonID).prop('disabled', true);
- $(restartButtonID).prop('disabled', true);
- // Check if there is any VM is running.
- kimchi.listVMs(function(vms) {
- for(var i = 0; i < vms.length; i++) {
- if(vms[i]['state'] === 'running') {
- wok.message.error.code('KCHHOST6001E');
- $(shutdownButtonID).prop('disabled', false);
- $(restartButtonID).prop('disabled', false);
- return;
- }
- }
-
- });
- }, function() {
- });
- };
-
- var initPage = function() {
- $('#host-info-container .section-header').each(function(i, header) {
- $('<span class="arrow"></span>').prependTo(header);
- var toExpand = $(header).attr('aria-expanded') !== 'false';
- expand(header, toExpand);
- });
-
- $('#host-info-container').on('click', '.section-header', function(event) {
- var toExpand = $(this).attr('aria-expanded') === 'false';
- expand(this, toExpand);
- });
-
- $('#host-button-shutdown').on('click', function(event) {
- shutdownHost(null);
- });
-
- $('#host-button-restart').on('click', function(event) {
- shutdownHost({
- reboot: true
- });
- });
-
- var setupUI = function() {
- if (kimchi.capabilities == undefined) {
- setTimeout(setupUI, 2000);
- return;
- }
-
- if((kimchi.capabilities['repo_mngt_tool']) && (kimchi.capabilities['repo_mngt_tool']!="None")) {
- initRepositoriesGrid(kimchi.capabilities['repo_mngt_tool']);
- $('#repositories-section').switchClass('hidden', kimchi.capabilities['repo_mngt_tool']);
- wok.topic('kimchi/repositoryAdded')
- .subscribe(listRepositories);
- wok.topic('kimchi/repositoryUpdated')
- .subscribe(listRepositories);
- wok.topic('kimchi/repositoryDeleted')
- .subscribe(listRepositories);
- }
-
- if(kimchi.capabilities['update_tool']) {
- $('#software-update-section').removeClass('hidden');
- initSoftwareUpdatesGrid();
- wok.topic('kimchi/softwareUpdated')
- .subscribe(listSoftwareUpdates);
- $('#software-updates-progress-container').accordion({
- collapsible: true
- });
- }
-
- if(kimchi.capabilities['system_report_tool']) {
- listDebugReports();
- wok.topic('kimchi/debugReportAdded')
- .subscribe(listDebugReports);
- wok.topic('kimchi/debugReportRenamed')
- .subscribe(listDebugReports);
- }
- };
- setupUI();
- };
-
- kimchi.getHost(function(data) {
- var htmlTmpl = $('#host-tmpl').html();
- data['logo'] = data['logo'] || '';
- data['memory'] = wok.formatMeasurement(data['memory'], {
- fixed: 2
- });
- var templated = wok.substitute(htmlTmpl, data);
- $('#host-content-container').html(templated);
-
- initPage();
- initTracker();
- });
-
- var StatsMgr = function() {
- var statsArray = {
- cpu: {
- u: {
- type: 'percent',
- legend: i18n['KCHHOST6002M'],
- points: []
- }
- },
- memory: {
- u: {
- type: 'value',
- base: 2,
- fixed: 2,
- legend: i18n['KCHHOST6003M'],
- points: []
- }
- },
- diskIO: {
- r: {
- type: 'value',
- base: 2,
- fixed: 2,
- unit: 'B/s',
- legend: i18n['KCHHOST6004M'],
- points: []
- },
- w: {
- type: 'value',
- base: 2,
- fixed: 2,
- unit: 'B/s',
- legend: i18n['KCHHOST6005M'],
- 'class': 'disk-write',
- points: []
- }
- },
- networkIO: {
- r: {
- type: 'value',
- base: 2,
- fixed: 2,
- unit: 'B/s',
- legend: i18n['KCHHOST6006M'],
- points: []
- },
- s: {
- type: 'value',
- base: 2,
- fixed: 2,
- unit: 'B/s',
- legend: i18n['KCHHOST6007M'],
- 'class': 'network-sent',
- points: []
- }
- }
- };
- var SIZE = 20;
- var cursor = SIZE;
-
- var add = function(stats) {
- for(var key in stats) {
- var item = stats[key];
- for(var metrics in item) {
- var value = item[metrics]['v'];
- var max = item[metrics]['max'];
- var unifiedMetrics = statsArray[key][metrics];
- var ps = unifiedMetrics['points'];
- if(!Array.isArray(value)){
- ps.push(value);
- if(ps.length > SIZE + 1) {
- ps.shift();
- }
- }
- else{
- ps=ps.concat(value);
- ps.splice(0, ps.length-SIZE-1);
- unifiedMetrics['points']=ps;
- }
- if(max !== undefined) {
- unifiedMetrics['max'] = max;
- }
- else {
- if(unifiedMetrics['type'] !== 'value') {
- continue;
- }
- max = -Infinity;
- $.each(ps, function(i, value) {
- if(value > max) {
- max = value;
- }
- });
- if(max === 0) {
- ++max;
- }
- max *= 1.1;
- unifiedMetrics['max'] = max;
- }
- }
- }
- cursor++;
- };
-
- var get = function(which) {
- var stats = statsArray[which];
- var lines = [];
- for(var k in stats) {
- var obj = stats[k];
- var line = {
- type: obj['type'],
- base: obj['base'],
- unit: obj['unit'],
- fixed: obj['fixed'],
- legend: obj['legend']
- };
- if(obj['max']) {
- line['max'] = obj['max'];
- }
- if(obj['class']) {
- line['class'] = obj['class'];
- }
- var ps = obj['points'];
- var numStats = ps.length;
- var unifiedPoints = [];
- $.each(ps, function(i, value) {
- unifiedPoints.push({
- x: cursor - numStats + i,
- y: value
- });
- });
- line['points'] = unifiedPoints;
- lines.push(line);
- }
- return lines;
- };
-
- return {
- add: add,
- get: get
- };
- };
-
- var Tracker = function(charts) {
- var charts = charts;
- var timer = null;
- var statsPool = new StatsMgr();
- var setCharts = function(newCharts) {
- charts = newCharts;
- for(var key in charts) {
- var chart = charts[key];
- chart.updateUI(statsPool.get(key));
- }
- };
-
- var self = this;
-
- var UnifyStats = function(stats) {
- var result= {
- cpu: {
- u: {
- v: stats['cpu_utilization']
- }
- },
- memory: {
- u: {
- }
- },
- diskIO: {
- r: {
- v: stats['disk_read_rate']
- },
- w: {
- v: stats['disk_write_rate']
- }
- },
- networkIO: {
- r: {
- v: stats['net_recv_rate']
- },
- s: {
- v: stats['net_sent_rate']
- }
- }
- };
- if(Array.isArray(stats['memory'])){
- result.memory.u['v']=[];
- result.memory.u['max']=-Infinity;
- for(var i=0;i<stats['memory'].length;i++){
- result.memory.u['v'].push(stats['memory'][i]['avail']);
- result.memory.u['max']=Math.max(result.memory.u['max'],stats['memory'][i]['total']);
- }
- }
- else {
- result.memory.u['v']=stats['memory']['avail'],
- result.memory.u['max']=stats['memory']['total']
- }
- return(result);
- };
-
-
- var statsCallback = function(stats) {
- var unifiedStats = UnifyStats(stats);
- statsPool.add(unifiedStats);
- for(var key in charts) {
- var chart = charts[key];
- chart.updateUI(statsPool.get(key));
- }
- timer = setTimeout(function() {
- continueTrack();
- }, 1000);
- };
-
- var track = function() {
- kimchi.getHostStatsHistory(statsCallback,
- function() {
- continueTrack();
- });
- };
-
- var continueTrack = function() {
- kimchi.getHostStats(statsCallback,
- function() {
- continueTrack();
- });
- };
-
- var destroy = function() {
- timer && clearTimeout(timer);
- timer = null;
- };
-
- return {
- setCharts: setCharts,
- start: track,
- stop: destroy
- };
- };
-
- var initTracker = function() {
- // TODO: Extend tabs with onUnload event to unregister timers.
- if(kimchi.hostTimer) {
- kimchi.hostTimer.stop();
- delete kimchi.hostTimer;
- }
-
- var trackedCharts = {
- cpu: new kimchi.widget.LineChart({
- id: 'chart-cpu',
- node: 'container-chart-cpu',
- type: 'percent'
- }),
- memory: new kimchi.widget.LineChart({
- id: 'chart-memory',
- node: 'container-chart-memory',
- type: 'value'
- }),
- diskIO: new kimchi.widget.LineChart({
- id: 'chart-disk-io',
- node: 'container-chart-disk-io',
- type: 'value'
- }),
- networkIO: new kimchi.widget.LineChart({
- id: 'chart-network-io',
- node: 'container-chart-network-io',
- type: 'value'
- })
- };
-
- if(kimchi.hostTimer) {
- kimchi.hostTimer.setCharts(trackedCharts);
- }
- else {
- kimchi.hostTimer = new Tracker(trackedCharts);
- kimchi.hostTimer.start();
- }
- };
-
- $('#host-root-container').on('remove', function() {
- if(kimchi.hostTimer) {
- kimchi.hostTimer.stop();
- delete kimchi.hostTimer;
- }
-
- repositoriesGrid && repositoriesGrid.destroy();
- wok.topic('kimchi/repositoryAdded')
- .unsubscribe(listRepositories);
- wok.topic('kimchi/repositoryUpdated')
- .unsubscribe(listRepositories);
- wok.topic('kimchi/repositoryDeleted')
- .unsubscribe(listRepositories);
-
- softwareUpdatesGrid && softwareUpdatesGrid.destroy();
- wok.topic('kimchi/softwareUpdated').unsubscribe(listSoftwareUpdates);
-
- reportGrid && reportGrid.destroy();
- wok.topic('kimchi/debugReportAdded').unsubscribe(listDebugReports);
- wok.topic('kimchi/debugReportRenamed').unsubscribe(listDebugReports);
- });
-};
diff --git a/plugins/kimchi/ui/js/src/kimchi.report_add_main.js b/plugins/kimchi/ui/js/src/kimchi.report_add_main.js
deleted file mode 100644
index 5f098d3..0000000
--- a/plugins/kimchi/ui/js/src/kimchi.report_add_main.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013-2014
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-kimchi.report_add_main = function() {
- var reportGridID = 'available-reports-grid';
- var addReportForm = $('#form-report-add');
- var submitButton = $('#button-report-add');
- var nameTextbox = $('input[name="name"]', addReportForm);
- nameTextbox.select();
-
- var submitForm = function(event) {
- if(submitButton.prop('disabled')) {
- return false;
- }
- var reportName = nameTextbox.val();
- var validator = RegExp("^[_A-Za-z0-9-]*$");
- if (!validator.test(reportName)) {
- wok.message.error.code('KCHDR6011M');
- return false;
- }
- var formData = addReportForm.serializeObject();
- var taskAccepted = false;
- var onTaskAccepted = function() {
- if(taskAccepted) {
- return;
- }
- taskAccepted = true;
- wok.window.close();
- wok.topic('kimchi/debugReportAdded').publish();
- };
-
- kimchi.createReport(formData, function(result) {
- onTaskAccepted();
- wok.topic('kimchi/debugReportAdded').publish();
- }, function(result) {
- // Error message from Async Task status
- if (result['message']) {
- var errText = result['message'];
- }
- // Error message from standard kimchi exception
- else {
- var errText = result['responseJSON']['reason'];
- }
- result && wok.message.error(errText);
-
- taskAccepted &&
- $('.grid-body-view table tr:first-child',
- '#' + reportGridID).remove();
- submitButton.prop('disabled', false);
- nameTextbox.select();
- }, onTaskAccepted);
-
- event.preventDefault();
- };
-
- addReportForm.on('submit', submitForm);
- submitButton.on('click', submitForm);
-};
diff --git a/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js b/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js
deleted file mode 100644
index 1bdb8d9..0000000
--- a/plugins/kimchi/ui/js/src/kimchi.report_rename_main.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-kimchi.report_rename_main = function() {
- var renameReportForm = $('#form-report-rename');
- var submitButton = $('#button-report-rename');
- var nameTextbox = $('input[name="name"]', renameReportForm);
- var submitForm = function(event) {
- if(submitButton.prop('disabled')) {
- return false;
- }
- var reportName = nameTextbox.val();
-
- // if the user hasn't changed the report's name,
- // nothing should be done.
- if (reportName == kimchi.selectedReport) {
- wok.message.error.code('KCHDR6013M');
- return false;
- }
-
- var validator = RegExp("^[A-Za-z0-9-]*$");
- if (!validator.test(reportName)) {
- wok.message.error.code('KCHDR6011M');
- return false;
- }
- var formData = renameReportForm.serializeObject();
- submitButton.prop('disabled', true);
- nameTextbox.prop('disabled', true);
- kimchi.renameReport(kimchi.selectedReport, formData, function(result) {
- submitButton.prop('disabled', false);
- nameTextbox.prop('disabled', false);
- wok.window.close();
- wok.topic('kimchi/debugReportRenamed').publish({
- result: result
- });
- }, function(result) {
- var errText = result &&
- result['responseJSON'] &&
- result['responseJSON']['reason'];
- wok.message.error(errText);
- submitButton.prop('disabled', false);
- nameTextbox.prop('disabled', false).focus();
- });
-
- event.preventDefault();
- };
-
- renameReportForm.on('submit', submitForm);
- submitButton.on('click', submitForm);
-
- nameTextbox.val(kimchi.selectedReport).select();
-};
diff --git a/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js b/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js
deleted file mode 100644
index 656306b..0000000
--- a/plugins/kimchi/ui/js/src/kimchi.repository_add_main.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-kimchi.repository_add_main = function() {
-
- var addForm = $('#form-repository-add');
- var addButton = $('#button-repository-add');
-
- var validateField = function(event) {
- var valid=($(this).val()!=='');
- $(addButton).prop('disabled', !valid);
- return(valid);
- };
-
- var validateForm = function(event) {
- var valid=false;
- addForm.find('input.required').each( function() {
- valid=($(this).val()!=='');
- return(!valid);
- });
- return(valid);
- }
-
- addForm.find('input.required').on('input propertychange', validateField);
-
- var weedObject = function(obj) {
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- if((typeof(obj[key])==="object") && !Array.isArray(obj[key])) {
- weedObject(obj[key]);
- }
- else if(obj[key] == '') {
- delete obj[key];
- }
- }
- }
- }
-
- var addRepository = function(event) {
- var valid = validateForm();
- if(!valid) {
- return false;
- }
-
- var formData = $(addForm).serializeObject();
-
- if (formData && formData.isMirror!=undefined) {
- formData.isMirror=(String(formData.isMirror).toLowerCase() === 'true');
- }
- if(formData.isMirror) {
- if(formData.config==undefined) {
- formData.config=new Object();
- }
- formData.config.mirrorlist=formData.baseurl;
- delete formData.baseurl;
- delete formData.isMirror;
- }
- weedObject(formData);
- if(formData.config && formData.config.comps) {
- formData.config.comps=formData.config.comps.split(/[,\s]/);
- for(var i=0; i>formData.config.comps.length; i++) {
- formData.config.comps[i]=formData.config.comps[i].trim();
- }
- for (var j=formData.config.comps.indexOf(""); j!=-1; j=formData.config.comps.indexOf("")) {
- formData.config.comps.splice(j, 1);
- }
- }
-
- kimchi.createRepository(formData, function() {
- wok.topic('kimchi/repositoryAdded').publish();
- wok.window.close();
- }, function(jqXHR, textStatus, errorThrown) {
- var reason = jqXHR &&
- jqXHR['responseJSON'] &&
- jqXHR['responseJSON']['reason'];
- wok.message.error(reason);
- });
- return false;
- };
-
- $(addForm).on('submit', addRepository);
-};
diff --git a/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js b/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js
deleted file mode 100644
index 5bfc51e..0000000
--- a/plugins/kimchi/ui/js/src/kimchi.repository_edit_main.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-kimchi.repository_edit_main = function() {
-
- var editForm = $('#form-repository-edit');
-
- var saveButton = $('#repository-edit-button-save');
-
- if(kimchi.capabilities['repo_mngt_tool']=="yum") {
- editForm.find('input.deb').prop('disabled', true);
- }
- else if(kimchi.capabilities['repo_mngt_tool']=="deb") {
- editForm.find('input.yum').prop('disabled', true);
- }
-
- kimchi.retrieveRepository(kimchi.selectedRepository, function(repository) {
- editForm.fillWithObject(repository);
-
- $('input', editForm).on('input propertychange', function(event) {
- if($(this).val() !== '') {
- $(saveButton).prop('disabled', false);
- }
- });
- });
-
-
- var editRepository = function(event) {
- var formData = $(editForm).serializeObject();
-
- if (formData && formData.config) {
- formData.config.gpgcheck=(String(formData.config.gpgcheck).toLowerCase() === 'true');
- }
-
- if(formData.config && formData.config.comps) {
- formData.config.comps=formData.config.comps.split(/[,\s]/);
- for(var i=0; i>formData.config.comps.length; i++) {
- formData.config.comps[i]=formData.config.comps[i].trim();
- }
- for (var j=formData.config.comps.indexOf(""); j!=-1; j=formData.config.comps.indexOf("")) {
- formData.config.comps.splice(j, 1);
- }
- }
-
- kimchi.updateRepository(kimchi.selectedRepository, formData, function() {
- wok.topic('kimchi/repositoryUpdated').publish();
- wok.window.close();
- }, function(jqXHR, textStatus, errorThrown) {
- var reason = jqXHR &&
- jqXHR['responseJSON'] &&
- jqXHR['responseJSON']['reason'];
- wok.message.error(reason);
- });
-
- return false;
- };
-
- $(editForm).on('submit', editRepository);
- $(saveButton).on('click', editRepository);
-};
diff --git a/plugins/kimchi/ui/pages/help/de_DE/host.dita b/plugins/kimchi/ui/pages/help/de_DE/host.dita
deleted file mode 100644
index 33a40e3..0000000
--- a/plugins/kimchi/ui/pages/help/de_DE/host.dita
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="de-de">
-<title>Host</title>
-<shortdesc>Die Seite <wintitle>Host</wintitle> zeigt Informationen zum Hostsystem an und ermöglicht Ihnen, den Host herunterzufahren, erneut zu starten und eine Verbindung zu ihm herzustellen.</shortdesc>
-<csbody>
-<p>Sie können die folgenden Aktionen am Host durchführen:<ul>
-<li>Wählen Sie <uicontrol>Herunterfahren</uicontrol> aus, um das Hostsystem herunterzufahren.</li>
-<li>Wählen Sie <uicontrol>Erneut starten</uicontrol> aus, um das Hostsystem erneut zu starten.</li>
-<li>Wählen Sie <uicontrol>Verbinden</uicontrol> aus, um eine VNC-Verbindung zum Hostsystem herzustellen, wenn noch keine Verbindung besteht.</li>
-</ul></p>
-<p>Klicken Sie auf die folgenden Abschnitte, um Informationen zum Host anzuzeigen:<dl>
-<dlentry>
-<dt>Basisinformationen</dt>
-<dd>Dieser Abschnitt zeigt die Verteilung, die Version und den Codenamen des Hostbetriebssystems sowie den Prozessortyp und die Speicherkapazität in GB an.</dd>
-</dlentry><dlentry>
-<dt>Systemstatistik</dt>
-<dd>Dieser Abschnitt zeigt mithilfe von Grafiken Statistiken für CPU, Speicher, Platten-E/A und Netz-E/A für den Host an. Wählen Sie <uicontrol>Daten werden nach dem Verlassen dieser Seite gesammelt</uicontrol> aus, um mit der Sammlung von Daten fortzufahren, wenn die Host-Registerkarte nicht angezeigt wird.</dd>
-</dlentry><dlentry>
-<dt>Software-Updates</dt>
-<dd>Dieser Abschnitt zeigt Informationen für alle Pakete an, bei denen Aktualisierungen verfügbar sind, einschließlich Paketname, Version, Architektur und Repository. Sie können alle aufgelisteten Pakete aktualisieren, indem Sie <uicontrol>Alle aktualisieren</uicontrol> auswählen. Sie können nicht einzelne Pakete zur Aktualisierung auswählen.</dd>
-</dlentry><dlentry>
-<dt>Repositorys</dt>
-<dd>Dieser Abschnitt zeigt Repositorys an, die dem Hostsystem zugeordnet sind. Sie können Repositorys hinzufügen, aktivieren, bearbeiten oder entfernen. Beim Hinzufügen wird ein Repository dem Hostsystem zugeordnet. Das Aktivieren eines Repositorys dagegen ermöglicht dem Host den Zugriff auf das Repository. Wenn Ihr System Red Hat Enterprise
-Linux oder Fedora ist, können Sie <filepath>yum</filepath>-Repositorys hinzufügen.
-Wenn Ihr System Ubuntu oder Debian ist, fügen Sie <filepath>deb</filepath>-Repositorys hinzu.<p>Wenn Sie mit yum-Repositorys arbeiten, können Sie eine GPG-Prüfung hinzufügen, um sicherzustellen, dass ein Paket aus diesem Repository nicht beschädigt wurde.
-Wählen Sie ein Repository und dann <uicontrol>Bearbeiten</uicontrol> aus. Wählen Sie <uicontrol>Ja</uicontrol> aus, um die GPG-Prüfung zu aktivieren, und geben Sie dann ein URL zur GPG-Schlüsseldatei für das Repository ein.</p></dd>
-</dlentry><dlentry>
-<dt>Debugberichte</dt>
-<dd>Dieser Abschnitt zeigt Debugberichte, einschließlich Name und Dateipfad, an.
-Sie haben die Möglichkeit, einen neuen Bericht zu erstellen oder einen bestehenden Bericht umzubenennen, zu entfernen oder herunterzuladen.<p>Der Debugbericht wird während des Befehls <cmdname>sosreport</cmdname> generiert. Er ist verfügbar für Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>-, Fedora-
-und Ubuntu-Verteilungen. Der Befehl generiert eine .tar-Datei, die Konfigurations- und Diagnoseinformationen enthält, wie zum Beispiel Kernelversion, geladene Module sowie System- und Servicekonfigurationdateien.
-Der Befehl führt zudem externe Programme aus, um weitere Informationen zu sammeln, und speichert diese Ausgabe im resultierenden Archiv.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/en_US/host.dita b/plugins/kimchi/ui/pages/help/en_US/host.dita
deleted file mode 100644
index 0dcb670..0000000
--- a/plugins/kimchi/ui/pages/help/en_US/host.dita
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-<?Pub Sty _display FontColor="red"?>
-<?Pub Inc?>
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="en-us">
-<title>Host</title>
-<shortdesc>The <wintitle>Host</wintitle> page shows information about
-the host system, and allows you to shut down, restart, and connect
-to the host.</shortdesc>
-<csbody>
-<p>You can perform the following actions on the host:<ul>
-<li>Select <uicontrol>Shut down</uicontrol> to shut down the host
-system.</li>
-<li>Select <uicontrol>Restart</uicontrol> to restart the host system.</li>
-<li>Select <uicontrol>Connect</uicontrol> to open a VNC connection
-to the host system, if it is not already connected.</li>
-</ul></p>
-<p>Click the following sections to display information about the host:<dl>
-<dlentry>
-<dt>Basic information</dt>
-<dd>This section displays the host operating system distribution,
-version, and code name, as well as the processor type, the number of
-online CPUs and amount of memory in GB.</dd>
-</dlentry><dlentry>
-<dt>System statistics</dt>
-<dd>This section displays graphs to show statistics for CPU, memory,
-disk I/O, and network I/O for the host. Select <uicontrol>Collecting
-data after leaving this page</uicontrol> to continue collecting data
-when the host tab is out of view.</dd>
-</dlentry><dlentry>
-<dt>Software Updates</dt>
-<dd>This section displays information for all of the packages that
-have updates available, including package name, version, architecture,
-and repository. You can update all of the packages listed by selecting <uicontrol>Update
-All</uicontrol>. You cannot select individual packages for updates.</dd>
-</dlentry><dlentry>
-<dt>Repositories</dt>
-<dd>This section displays repositories that are associated with the
-host system. You can add, enable, edit, or remove repositories. Adding
-a repository associates it with the host system while enabling a repository
-allows the host to access it. If your system is Red Hat Enterprise
-Linux or Fedora, you can add <filepath>yum</filepath> repositories.
-If your system is Ubuntu or Debian, then add <filepath>deb</filepath> repositories.<p>If
-you are working with yum repositories, you can add a GPG check to
-verify that a package from this repository have not been corrupted.
-Select a repository and then <uicontrol>Edit</uicontrol>. Select <uicontrol>Yes</uicontrol> to
-enable GPG Check and then enter a URL to the GPG key file for the
-repository.</p><?Pub Caret 156?></dd>
-</dlentry><dlentry>
-<dt>Debug reports</dt>
-<dd>This section displays debug reports, including name and file path.
-You can select from options to generate a new report, or rename, remove,
-or download an existing report.<p>The debug report is generated using
-the <cmdname>sosreport</cmdname> command. It is available for Red
-Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora,
-and Ubuntu distributions. The command generates a .tar file that contains
-configuration and diagnostic information, such as the running kernel
-version, loaded modules, and system and service configuration files.
-The command also runs external programs to collect further information
-and stores this output in the resulting archive.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-<?Pub *0000003492?>
diff --git a/plugins/kimchi/ui/pages/help/es_ES/host.dita b/plugins/kimchi/ui/pages/help/es_ES/host.dita
deleted file mode 100644
index 7734244..0000000
--- a/plugins/kimchi/ui/pages/help/es_ES/host.dita
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="es-es">
-<title>Host</title>
-<shortdesc>La página <wintitle>Host</wintitle> muestra información sobre el sistema host y le permite concluir, reiniciar y conectar con el sistema principal.</shortdesc>
-<csbody>
-<p>Puede realizar las acciones siguientes en el host:<ul>
-<li>Seleccione <uicontrol>Concluir</uicontrol> para concluir el sistema host.</li>
-<li>Seleccione <uicontrol>Reiniciar</uicontrol> para reiniciar el sistema host.</li>
-<li>Seleccione <uicontrol>Conectar</uicontrol> para abrir una conexión VNC al sistema host, si no está conectado aún.</li>
-</ul></p>
-<p>Pulse en las secciones siguientes para visualizar información acerca del host:<dl>
-<dlentry>
-<dt>Información básica</dt>
-<dd>Esta sección muestra la distribución del sistema operativo de host, la versión y el nombre de código, así como el tipo de procesador y la cantidad de memoria en GB.</dd>
-</dlentry><dlentry>
-<dt>Estadísticas del sistema</dt>
-<dd>Esta sección muestra gráficos para mostrar estadísticas para CPU, memoria, E/S de disco y E/S de red para el host. Seleccione <uicontrol>Recoger datos después de salir de esta página</uicontrol> para continuar la recogida de datos cuando la pestaña principal ya no está a la vista.</dd>
-</dlentry><dlentry>
-<dt>Actualizaciones de software</dt>
-<dd>En esta sección se muestra información para todos los paquetes que tienen actualizaciones disponibles, incluido el nombre de paquete, versión, arquitectura y repositorio. Puede actualizar todos los paquetes listados seleccionando <uicontrol>Actualizar todo</uicontrol>. No puede seleccionar paquetes individuales para las actualizaciones.</dd>
-</dlentry><dlentry>
-<dt>Repositorios</dt>
-<dd>En esta sección se muestran los repositorios que están asociados con el sistema host. Puede añadir, habilitar, editar o eliminar repositorios. Añadir un repositorio lo asocia con el sistema host mientras que habilitar un repositorio permite que el host acceda a él. Si el sistema es Red Hat Enterprise
-Linux o Fedora, puede añadir repositorios <filepath>yum</filepath>.
-Si el sistema es Ubuntu o Debian, añada repositorios <filepath>deb</filepath>.<p>Si está trabajando con repositorios yum, puede añadir una comprobación GPG para verificar que un paquete de este repositorio no ha resultado dañado.
-Seleccione un repositorio y, a continuación, <uicontrol>Editar</uicontrol>. Seleccione <uicontrol>Sí</uicontrol> para habilitar la comprobación GPG y, a continuación, especifique un URL al archivo de claves GPG para el repositorio.</p></dd>
-</dlentry><dlentry>
-<dt>Informes de depuración</dt>
-<dd>En esta sección se muestran informes de depuración, incluido el nombre y la ruta de archivo.
-Puede seleccionar entre opciones para generar un informe nuevo, o bien redenominar, eliminar o descargar un informe existente.<p>El informe de depuración se genera utilizando el mandato <cmdname>sosreport</cmdname>. Está disponible para distribuciones de Red
-Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora y Ubuntu. El mandato genera un archivo .tar que contiene la información de configuración y de diagnóstico, como la versión de kernel en ejecución, los módulos de carga y los archivos de configuración del sistema y servicio.
-El mandato también ejecuta programas externos para recopilar información adicional y almacena esta salida en el archivo resultante.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/fr_FR/host.dita b/plugins/kimchi/ui/pages/help/fr_FR/host.dita
deleted file mode 100644
index f4c330b..0000000
--- a/plugins/kimchi/ui/pages/help/fr_FR/host.dita
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="fr-fr">
-<title>Hôte</title>
-<shortdesc>La page <wintitle>Hôte</wintitle> affiche des informations
-sur le système hôte et vous permet d'arrêter, de redémarrer et de vous
-connecter à l'hôte.</shortdesc>
-<csbody>
-<p>Vous pouvez effectuer les actions suivantes sur l'hôte :<ul>
-<li>Sélectionnez <uicontrol>Arrêter</uicontrol> pour arrêter le système hôte.</li>
-<li>Sélectionnez <uicontrol>Redémarrer</uicontrol> pour redémarrer le système hôte.</li>
-<li>Sélectionnez <uicontrol>Connexion</uicontrol> pour ouvrir une connexion VNC
-au système hôte, si celui-ci n'est pas déjà connecté.</li>
-</ul></p>
-<p>Cliquez sur les sections suivantes pour afficher des informations sur l'hôte :<dl>
-<dlentry>
-<dt>Informations de base</dt>
-<dd>Cette section affiche la distribution, la version et le nom de code
-du système d'exploitation hôte, ainsi que le type de processeur et la quantité
-de mémoire en Go.</dd>
-</dlentry><dlentry>
-<dt>Statistiques système</dt>
-<dd>Cette section affiche les graphiques des statistiques pour l'UC, mémoire, ainsi que
-les E-S disque et E-S réseau pour l'hôte. Sélectionnez <uicontrol>Collecte des données une fois la page quittée</uicontrol>
-pour continuer la collecte de données lorsque l'onglet hôte n'est plus visible.</dd>
-</dlentry><dlentry>
-<dt>Mises à jour logicielles</dt>
-<dd>Cette section affiche des informations pour tous les modules qui
-disposent de mises à jour disponibles, y compris le nom de module, la version, l'architecture
-et le référentiel. Vous pouvez mettre à jour toutes les modules répertoriés en sélectionnant <uicontrol>Tout
-mettre à jour</uicontrol>. Vous ne pouvez pas sélectionner des modules individuels pour les mises à jour.</dd>
-</dlentry><dlentry>
-<dt>Référentiels</dt>
-<dd>Cette section affiche les référentiels associés au système hôte. Vous pouvez ajouter, activer, éditer ou retirer des référentiels. L'ajout d'un référentiel associe celui-ci au système hôte,
-tandis que l'activation d'un référentiel permet à l'hôte d'y accéder. Si votre système est Red Hat Enterprise Linux ou Fedora,
-vous pouvez ajouter des référentiels <filepath>yum</filepath>.
-Si votre système est de type Ubuntu ou Debian, ajoutez des référentiels
-<filepath>deb</filepath>.<p>Si vous travaillez avec des référentiels yum, vous pouvez ajouter un contrôle GPG
-afin de vérifier qu'un module provenant de ce référentiel n'a pas été endommagé.
-Sélectionnez un référentiel puis cliquez sur <uicontrol>Editer</uicontrol>. Sélectionnez <uicontrol>Oui</uicontrol> pour activer le contrôle GPG,
-puis entrez une URL pour le fichier de clés GPG du référentiel.</p></dd>
-</dlentry><dlentry>
-<dt>Rapports de débogage</dt>
-<dd>Cette section affiche les rapports de débogage, y compris le nom et le chemin du fichier.
-Vous pouvez faire un choix parmi les options afin de générer un nouveau rapport, ou renommer, supprimer,
-ou télécharger un rapport existant.<p>Le rapport de débogage est généré à
-l'aide de la commande <cmdname>sosreport</cmdname>. Cette option est disponible pour les distributions
-Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora et Ubuntu. La commande génère un fichier .tar contenant la configuration et des informations de diagnostic,
-telles que la version du noyau d'exécution, les modules chargés, ainsi que les fichiers de configuration
-du système et de la maintenance.
-La commande exécute également des programmes externes pour collecter des informations
-supplémentaires et stocke cette sortie dans l'archive résultante.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/it_IT/host.dita b/plugins/kimchi/ui/pages/help/it_IT/host.dita
deleted file mode 100644
index 63d3367..0000000
--- a/plugins/kimchi/ui/pages/help/it_IT/host.dita
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="it-it">
-<title>Host</title>
-<shortdesc>La pagina <wintitle>Host</wintitle> visualizza le informazioni sul sistema host e consente di arrestarlo, riavviarlo e connettersi ad esso.</shortdesc>
-<csbody>
-<p>È possibile effettuare le seguenti operazioni sull'host:<ul>
-<li>Selezionare <uicontrol>Arresta</uicontrol> per arrestare il sistema host.</li>
-<li>Selezionare <uicontrol>Riavvia</uicontrol> per riavviare il sistema host.</li>
-<li>Selezionare <uicontrol>Connetti</uicontrol> per aprire una connessione VNC al sistema host, se non è già connesso.</li>
-</ul></p>
-<p>Fare clic sulle seguenti sezioni per visualizzare le informazioni sull'host:<dl>
-<dlentry>
-<dt>Informazioni di base</dt>
-<dd>Questa sezione visualizza il nome codice, la versione e la distribuzione del sistema operativo, come pure il tipo di processore e la quantità di memoria in GB.</dd>
-</dlentry><dlentry>
-<dt>Statistiche di sistema</dt>
-<dd>Questa sezione visualizza i grafici che mostrano le statistiche per la CPU, la memoria, l'I/O disco e di rete per l'host. Selezionare <uicontrol>Raccolta dati all'uscita dalla pagina</uicontrol> per continuare la raccolta dei dati quando la scheda host non è più visibile.</dd>
-</dlentry><dlentry>
-<dt>Aggiornamenti del software</dt>
-<dd>Questa sezione visualizza le informazioni per tutti i pacchetti per cui sono disponibili gli aggiornamenti, incluso il nome, la versione, l'architettura e il repository del pacchetto. È possibile aggiornare tutti i pacchetti elencati, selezionando <uicontrol>Aggiorna tutto</uicontrol>. Non è possibile selezionare singoli pacchetti per gli aggiornamenti.</dd>
-</dlentry><dlentry>
-<dt>Repository</dt>
-<dd>Questa sezione visualizza i repository associati al sistema host. È possibile aggiungere, abilitare, modificare o rimuovere i repository. L'aggiunta di un repository lo associa al sistema host, mentre l'abilitazione di un repository
-consente all'host di accedervi. Se il sistema è Red Hat Enterprise
-Linux o Fedora, è possibile aggiungere i repository <filepath>yum</filepath>.
-Se il sistema è Ubuntu o Debian, aggiungere i repository <filepath>deb</filepath>.<p>Se si stanno utilizzando i repository yum, è possibile aggiungere un controllo GPG per verificare che un pacchetto da questo repository non sia stato corrotto.
-Selezionare un repository, quindi <uicontrol>Modifica</uicontrol>. Selezionare <uicontrol>Sì</uicontrol> per abilitare il controllo GPG, quindi immettere un URL al file di chiavi GPG per il
-repository.</p></dd>
-</dlentry><dlentry>
-<dt>Report di debug</dt>
-<dd>Questa sezione visualizza i report di debug, incluso il nome e il percorso file.
-Le opzioni disponibili consentono di generare un nuovo report oppure ridenominare, rimuovere o scaricare un report esistente.<p>Il report di debug viene generato utilizzando il comando <cmdname>sosreport</cmdname>. È disponibile per le distribuzioni Red
-Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora e Ubuntu. Il comando genera un file .tar che contiene informazioni di diagnostica e configurazione, come la versione del kernel in esecuzione, i moduli caricati e i file di configurazione del servizio e del sistema.
-Il comando esegue anche programmi esterni per raccogliere ulteriori informazioni e memorizza l'output nell'archivio risultante.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/ja_JP/host.dita b/plugins/kimchi/ui/pages/help/ja_JP/host.dita
deleted file mode 100644
index 3a0141c..0000000
--- a/plugins/kimchi/ui/pages/help/ja_JP/host.dita
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="ja-jp">
-<title>ホスト</title>
-<shortdesc><wintitle>「ホスト」</wintitle>ページには、ホスト・システムに関する情報が表示されます。ここで、ホストをシャットダウン、再始動、またホストに接続することができます。
-</shortdesc>
-<csbody>
-<p>以下のアクションをホストに対して実行できます。
-<ul>
-<li>ホスト・システムをシャットダウンするには<uicontrol>「シャットダウン」</uicontrol>を選択します。
-</li>
-<li>ホスト・システムを再始動するには<uicontrol>「再始動」</uicontrol>を選択します。
-</li>
-<li>ホスト・システムへの VNC 接続を (まだ接続されていない場合に) オープンするには、<uicontrol>「接続」</uicontrol>を選択します。
-</li>
-</ul></p>
-<p>ホストに関する情報を表示するには、以下の選択項目をクリックしてください。
-<dl>
-<dlentry>
-<dt>基本情報</dt>
-<dd>このセクションには、ホスト・オペレーティング・システムのディストリビューション、バージョン、およびコード名、さらにプロセッサー・タイプとメモリーの量 (GB 単位) が表示されます。
-</dd>
-</dlentry><dlentry>
-<dt>システム統計情報</dt>
-<dd>このセクションには、ホストの CPU、メモリー、ディスク入出力、およびネットワーク入出力の統計情報を表すグラフが表示されます。
-ホスト・タブを閉じたときにデータの収集を続行するには、<uicontrol>「このページを閉じた後、データを収集する」</uicontrol>を選択してください。
-</dd>
-</dlentry><dlentry>
-<dt>ソフトウェア更新</dt>
-<dd>このセクションには、更新が用意されているパッケージすべての情報
-(パッケージ名、バージョン、アーキテクチャー、リポジトリーなど) が表示されます。
-<uicontrol>「すべて更新」</uicontrol>を選択すると、リストされているパッケージすべてを更新できます。
-更新する対象として個別のパッケージを選択することはできません。
-</dd>
-</dlentry><dlentry>
-<dt>リポジトリー</dt>
-<dd>このセクションには、ホスト・システムに関連付けられているリポジトリーが表示されます。
-リポジトリーを追加する、有効にする、編集する、または削除することができます。
-リポジトリーを追加すると、そのリポジトリーがホスト・システムに関連付けられ、リポジトリーを有効にすると、そのリポジトリーにホストがアクセスできるようになります。
-システムが Red Hat Enterprise Linux または Fedora であれば、<filepath>yum</filepath> リポジトリーを追加できます。
-システムが Ubuntu または Debian であれば、<filepath>deb</filepath> リポジトリーを追加してください。
-<p>yum リポジトリーを操作している場合、そのリポジトリーに入っているパッケージが壊れていないことを確認するため、GPG チェックを追加できます。
-リポジトリーを選択し、<uicontrol>「編集」</uicontrol>をクリックしてください。
-<uicontrol>「はい」</uicontrol>を選択して GPG チェックを有効にしてから、そのリポジトリーの GPG 鍵ファイルの URL を入力してください。
-</p></dd>
-</dlentry><dlentry>
-<dt>デバッグ・レポート</dt>
-<dd>このセクションには、デバッグ・レポート (名前やファイル・パスなど) が表示されます。
-新しいレポートを生成、既存のレポートを名前変更、削除、またはダウンロードするためのオプションを選択できます。
-<p>デバッグ・レポートは、<cmdname>sosreport</cmdname> コマンドで生成されます。
-これは、Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>、Fedora、および Ubuntu ディストリビューションに用意されています。
-このコマンドは、構成および診断情報 (稼働中のカーネルのバージョン、ロードされているモジュール、システムおよびサービス構成ファイルなど) が入った .tar ファイルを生成します。
-このコマンドはまた、外部プログラムを実行して情報をさらに収集し、その出力を結果のアーカイブに保管します。
-</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 227 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 1 -->
diff --git a/plugins/kimchi/ui/pages/help/ko_KR/host.dita b/plugins/kimchi/ui/pages/help/ko_KR/host.dita
deleted file mode 100644
index ee4a9c3..0000000
--- a/plugins/kimchi/ui/pages/help/ko_KR/host.dita
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="ko-kr">
-<title>호스트</title>
-<shortdesc><wintitle>호스트</wintitle> 페이지에는 호스트 시스템에 대한 정보가 표시되며 이 페이지를 사용하여 호스트를 종료 및 다시 시작하거나 호스트에 연결할 수 있습니다.</shortdesc>
-<csbody>
-<p>호스트에 대해 다음 조치를 수행할 수 있습니다.<ul>
-<li>호스트 시스템을 종료하려면 <uicontrol>시스템 종료</uicontrol>를 선택합니다.</li>
-<li>호스트 시스템을 다시 시작하려면 <uicontrol>다시 시작</uicontrol>을 선택합니다.</li>
-<li>이미 연결되어 있지 않은 경우, 호스트 시스템에 대한 VNC 연결을 시작하려면 <uicontrol>연결</uicontrol>을 선택합니다.</li>
-</ul></p>
-<p>호스트에 대한 정보를 표시하려면 다음 섹션을 클릭하십시오.<dl>
-<dlentry>
-<dt>기본 정보</dt>
-<dd>이 섹션에는 호스트 운영 체제 배포, 버전, 코드 이름, 프로세서 유형, 메모리 용량(GB) 등이 표시됩니다.</dd>
-</dlentry><dlentry>
-<dt>시스템 통계</dt>
-<dd>이 섹션에는 호스트의 CPU, 메모리, 디스크 I/O, 네트워크 I/O에 대한 통계를 표시하는 그래프가 표시됩니다. 호스트 탭을 떠났을 때 데이터 수집을 계속하려면 <uicontrol>이 페이지를 떠난 후에 데이터 수집</uicontrol>을 선택합니다.</dd>
-</dlentry><dlentry>
-<dt>소프트웨어 업데이트</dt>
-<dd>이 섹션에는 패키지 이름, 버전, 아키텍처, 저장소를 비롯하여 사용 가능한 업데이트가 있는 모든 패키지에 대한 정보가 표시됩니다. <uicontrol>모두 업데이트</uicontrol>를 선택하여 나열된 모든 패키지를 업데이트할 수 있습니다. 업데이트에 대해 개별 패키지를 선택할 수는 없습니다.</dd>
-</dlentry><dlentry>
-<dt>저장소</dt>
-<dd>이 섹션에는 호스트 시스템과 연관된 저장소가 표시됩니다. 저장소를 추가하거나, 사용으로 설정하거나, 편집하거나, 제거할 수 있습니다. 저장소를 추가하면 저장소가 호스트 시스템과 연관되며, 저장소를 사용으로 설정하면 호스트가 저장소에 액세스할 수 있습니다. 해당 시스템이 Red Hat Enterprise Linux 또는 Fedora인 경우, <filepath>yum</filepath> 저장소를 추가할 수 있습니다.
-해당 시스템이 Ubuntu 또는 Debian인 경우, <filepath>deb</filepath> 저장소를 추가하십시오.<p>yum 저장소로 작업하는 경우, GPG 검사를 추가하여 이 저장소의 패키지가 손상되지 않았는지 확인할 수 있습니다.
-저장소를 선택한 후 <uicontrol>편집</uicontrol>을 선택하십시오. <uicontrol>예</uicontrol>를 선택하여 GPG 검사를 사용으로 설정한 후 저장소에 대한 GPG 키 파일의 URL을 입력하십시오.</p></dd>
-</dlentry><dlentry>
-<dt>디버그 보고서</dt>
-<dd>이 섹션에는 이름 및 파일 경로를 포함한 디버그 보고서가 표시됩니다.
-새 보고서 생성, 기존 보고서 이름 바꾸기, 제거, 다운로드 등의 옵션 중에서 선택할 수 있습니다.<p>디버그 보고서는 <cmdname>sosreport</cmdname> 명령을 사용하여 생성됩니다. 이는 Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora 및 Ubuntu 배포에서 사용 가능합니다. 이 명령은 구성 및 진단 정보(예: 실행 중인 커널 버전, 로드된 모듈, 시스템 및 서비스 구성 파일)를 포함하는 .tar 파일을 생성합니다.
-또한 이 명령은 외부 프로그램을 실행하여 추가 정보를 수집하고 결과 아카이브에 이 출력을 저장합니다.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/pt_BR/host.dita b/plugins/kimchi/ui/pages/help/pt_BR/host.dita
deleted file mode 100644
index 88f7eb2..0000000
--- a/plugins/kimchi/ui/pages/help/pt_BR/host.dita
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="pt-br">
-<title>Host</title>
-<shortdesc>A página <wintitle>Host</wintitle> mostra informações sobre
-o sistema host e permite encerrar, reiniciar e conectar
-ao host.</shortdesc>
-<csbody>
-<p>É possível executar as ações a segur no host:<ul>
-<li>Selecione <uicontrol>Encerrar</uicontrol> para encerrar o sistema
-host.</li>
-<li>Selecione <uicontrol>Reiniciar</uicontrol> para reiniciar o sistema host.</li>
-<li>Selecione <uicontrol>Conectar</uicontrol> para abrir uma conexão VNC
-para o sistema host, se ele já não estiver conectado.</li>
-</ul></p>
-<p>Clique nas seções a seguir para exibir informações sobre o host:<dl>
-<dlentry>
-<dt>Informações básicas</dt>
-<dd>Esta seção exibe a distribuição do sistema operacional do host,
-a versão e o nome do código, bem como o tipo de processador e quantia de
-memória em GB.</dd>
-</dlentry><dlentry>
-<dt>Estatísticas do sistema</dt>
-<dd>Esta seção exibe gráficos para mostrar estatísticas para CPU, memória,
-E/S de disco e E/S de rede para o host. Selecione <uicontrol>Coletando
-dados depois de sair desta página</uicontrol> para continuar a coletar dados
-quando a guia do host estiver fora de visualização.</dd>
-</dlentry><dlentry>
-<dt>Atualizações de software</dt>
-<dd>Esta seção exibe informações de todos os pacotes que
-possuem atualizações disponíveis, incluindo nome do pacote, versão, arquitetura
-e repositório. É possível atualizar todos os pacotes listados selecionando <uicontrol>Atualizar
-todos</uicontrol>. Não é possível selecionar pacotes individuais para atualizações.</dd>
-</dlentry><dlentry>
-<dt>Repositórios</dt>
-<dd>Esta seção exibe repositórios que estão associados ao
-sistema host. É possível incluir, ativar, editar ou remover repositórios. Incluir
-um repositório o associa com o sistema host enquanto ativar um repositório
-permite que o host o acesse. Se o seu sistema for Red Hat Enterprise
-Linux ou Fedora, será possível incluir repositórios <filepath>yum</filepath>.
-Se o seu sistema for Ubuntu ou Debian, inclua repositórios <filepath>deb</filepath>.<p>Se
-você estiver trabalhando com repositórios yum, será possível incluir uma verificação de GPG para
-verificar se um pacote desse repositório não foi corrompido.
-Selecione um repositório e, em seguida, <uicontrol>Editar</uicontrol>. Selecione <uicontrol>Sim</uicontrol> para
-ativar a Verificação de GPG e, em seguida, insira uma URL no arquivo-chave de GPG para o
-repositório.</p></dd>
-</dlentry><dlentry>
-<dt>Relatórios de depuração</dt>
-<dd>Esta seção exibe relatórios de depuração, incluindo nome e caminho do arquivo.
-É possível selecionar a partir das opções para gerar um novo relatório ou renomear, remover
-ou fazer o download de um relatório existente.<p>O relatório de depuração é gerado usando
-o comando <cmdname>sosreport</cmdname>. Ele está disponível para distribuições
-Red Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora
-e Ubuntu. O comando gera um arquivo .tar que contém
-informações de configuração e de diagnóstico, como versão do kernel
-em execução, módulos carregados e arquivos de configuração de sistema e de serviço.
-O comando também executa programas externos para coletar informações adicionais
-e armazena essa saída no archive resultante.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/ru_RU/host.dita b/plugins/kimchi/ui/pages/help/ru_RU/host.dita
deleted file mode 100644
index fb72c21..0000000
--- a/plugins/kimchi/ui/pages/help/ru_RU/host.dita
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="ru-ru">
-<title>Хост</title>
-<shortdesc>Страница <wintitle>Хост</wintitle> показывает информацию о системе хоста и позволяет останавливать хост, перезапускать хост и подключаться к нему.</shortdesc>
-<csbody>
-<p>На хосте можно выполнять следующие действия:<ul>
-<li><uicontrol>Завершить работу</uicontrol> - остановить систему хоста.</li>
-<li><uicontrol>Перезапустить</uicontrol> - перезапустить систему хоста.</li>
-<li><uicontrol>Подключиться</uicontrol> - открыть соединение VNC с системой хоста, если оно еще не установлено.</li>
-</ul></p>
-<p>Щелкните на следующих разделах для просмотра информации о хосте:<dl>
-<dlentry>
-<dt>Базовая информация</dt>
-<dd>В этом разделе показывается вариант операционной системы, его версия и кодовое имя, а также тип процессора и объем памяти в ГБ.</dd>
-</dlentry><dlentry>
-<dt>Системная статистика</dt>
-<dd>В этом разделе показываются графики, отражающие статистическую информацию о процессоре, памяти, дисковом вводе-выводе и сетевом вводе-выводе для хоста. Выберите <uicontrol>Сбор данных после закрытия этой страницы</uicontrol>, чтобы сбор данных продолжался после закрытия вкладки Хост.</dd>
-</dlentry><dlentry>
-<dt>Обновления программного обеспечения</dt>
-<dd>В этом разделе показывается информация обо всех пакетах, для которых доступны обновления, включая имя пакета, версию, архитектуру и хранилище. Можно обновить все пакеты в списке щелчком на <uicontrol>Обновить все</uicontrol>. Отдельные пакеты для обновления выбрать нельзя.</dd>
-</dlentry><dlentry>
-<dt>Хранилища</dt>
-<dd>В этом разделе показываются хранилища, связанные с системой хоста. Хранилища можно добавлять, активировать, изменять и удалять. При добавлении хранилище связывается с системой хоста, при активации хранилище становится доступным для хоста. Если система - Red Hat Enterprise Linux или Fedora, можно добавить хранилища <filepath>yum</filepath>.
-Если система - Ubuntu или Debian, добавьте хранилища <filepath>deb</filepath>.<p>При работе с хранилищами yum можно добавить проверку GPG для проверки целостности пакетов из данного хранилища.
-Выберите хранилище и щелкните на <uicontrol>Изменить</uicontrol>. Выберите <uicontrol>Да</uicontrol>, чтобы включить проверку GPG, и введите URL файла ключей GPG для хранилища.</p></dd>
-</dlentry><dlentry>
-<dt>Отладочные отчеты</dt>
-<dd>В этом разделе показываются отладочные отчеты, включая имя и путь.
-Доступны команды для создания, переименования, удаления и загрузки отчетов.<p>Отладочный отчет создается командой <cmdname>sosreport</cmdname>. Он доступен для Red
-Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>, Fedora и Ubuntu. Команда создает файл .tar с конфигурационной и диагностической информацией, такой как версия ядра, загруженные модули и файлы конфигурации системы и служб.
-Команда также выполняет внешние программы для сбора дополнительной информации и сохраняет их вывод в результирующем архиве.</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/zh_CN/host.dita b/plugins/kimchi/ui/pages/help/zh_CN/host.dita
deleted file mode 100644
index 78a89c3..0000000
--- a/plugins/kimchi/ui/pages/help/zh_CN/host.dita
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="zh-cn">
-<title>主机</title>
-<shortdesc>“<wintitle>主机</wintitle>”页面显示有关主机系统的信息,并且允许您对主机进行关闭、启动和连接。</shortdesc>
-<csbody>
-<p>可对主机执行以下操作:<ul>
-<li>选择<uicontrol>关闭</uicontrol>以关闭主机系统。</li>
-<li>选择<uicontrol>重新启动</uicontrol>以重新启动主机系统。</li>
-<li>选择<uicontrol>连接</uicontrol>以打开与主机系统的 VNC 连接(如果尚未连接)。</li>
-</ul></p>
-<p>单击以下部分以显示有关主机的信息:<dl>
-<dlentry>
-<dt>基本信息</dt>
-<dd>本部分显示主机操作系统分发版、版本和代码名称以及处理器类型和内存量(以 GB 计)。</dd>
-</dlentry><dlentry>
-<dt>系统统计信息</dt>
-<dd>本部分显示图形,以显示主机有关 CPU、内存、磁盘 I/O 和网络 I/O 的统计信息。选择<uicontrol>离开此页面之后收集数据</uicontrol>以继续在主机选项卡不在视图中时收集数据。</dd>
-</dlentry><dlentry>
-<dt>软件更新</dt>
-<dd>本部分显示有更新可用的所有软件包的信息,其中包括软件包名称、版本、体系结构和存储库。可通过选择<uicontrol>全部更新</uicontrol>来更新所列示的所有软件包。不能针对更新选择各个软件包。</dd>
-</dlentry><dlentry>
-<dt>存储库</dt>
-<dd>本部分显示与主机系统关联的存储库。您可以添加、启用、编辑或除去存储库。当启用存储库会允许主机对其进行访问时,添加存储库会将其与主机系统关联。如果您的系统为 Red Hat Enterprise Linux 或 Fedora,那么可添加 <filepath>yum</filepath> 存储库。如果您的系统为 Ubuntu 或 Debian,那么请添加 <filepath>deb</filepath> 存储库。<p>如果要处理 Yum 存储库,您可以添加 GPG 检查以验证此存储库中的软件包是否已损坏。选择一个存储库,然后选择<uicontrol>编辑</uicontrol>。选择<uicontrol>是</uicontrol>以启用 GPG 检查,然后输入存储库中 GPG 密钥文件的 URL。</p></dd>
-</dlentry><dlentry>
-<dt>调试报告</dt>
-<dd>本部分显示调试报告,其中包括名称和文件路径。您可以从选项中进行选择以生成新报告,或者对现有报告进行重命名、除去或下载。<p>调试报告将使用
-<cmdname>sosreport</cmdname> 命令生成。该报告可用于 Red
-Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>、Fedora 和 Ubuntu 分发版。该命令将生成包含配置和诊断信息的 .tar 文件,例如,正在运行的内核版本、已装入的模块以及系统和服务配置文件。该命令还会运行外部程序以收集更多信息并将此输出存储在生成的归档中。</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/help/zh_TW/host.dita b/plugins/kimchi/ui/pages/help/zh_TW/host.dita
deleted file mode 100644
index a55aae4..0000000
--- a/plugins/kimchi/ui/pages/help/zh_TW/host.dita
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Arbortext, Inc., 1988-2011, v.4002-->
-<!DOCTYPE cshelp PUBLIC "-//IBM//DTD DITA CSHelp//EN"
- "..\dtd\cshelp.dtd">
-
-
-<!--This DITA specialized document type is not supported by the Authoring Tools development team.
-For support please see:
-https://w3.opensource.ibm.com/projects/dita-cshelp/-->
-<cshelp id="kimhhost" xml:lang="zh-tw">
-<title>主機</title>
-<shortdesc>「<wintitle>主機</wintitle>」頁面會顯示主機系統的相關資訊,並容許您關閉、重新啟動以及連接到主機。</shortdesc>
-<csbody>
-<p>您可以針對主機執行下列動作:<ul>
-<li>選取<uicontrol>關閉</uicontrol>以關閉主機系統。</li>
-<li>選取<uicontrol>重新啟動</uicontrol>以重新啟動主機系統。</li>
-<li>選取<uicontrol>連接</uicontrol>以開啟與主機系統的 VNC 連線(如果尚未連線到主機系統)。</li>
-</ul></p>
-<p>按一下下列區段以顯示主機的相關資訊:<dl>
-<dlentry>
-<dt>基本資訊</dt>
-<dd>此區段會顯示主機作業系統發行套件、版本、程式碼名稱、處理器類型以及記憶體數量 (GB)。</dd>
-</dlentry><dlentry>
-<dt>系統統計資料</dt>
-<dd>此區段會顯示一些圖形,以顯示主機的 CPU、記憶體、磁碟 I/O 和網路 I/O 的統計資料。選取<uicontrol>離開此頁面之後收集資料</uicontrol>以在主機標籤從視線中消失之後繼續收集資料。</dd>
-</dlentry><dlentry>
-<dt>軟體更新</dt>
-<dd>此區段會顯示具有可用更新的所有套件的相關資訊,包括套件名稱、版本、架構和儲存庫。您可以透過選取<uicontrol>全部更新</uicontrol>來更新所有列出的套件。不能選取個別套件以進行更新。</dd>
-</dlentry><dlentry>
-<dt>儲存庫</dt>
-<dd>此區段會顯示與主機系統相關聯的儲存庫。您可以新增、啟用、編輯或移除儲存庫。新增儲存庫可使它與主機系統相關聯,而啟用儲存庫則容許主機存取儲存庫。如果您的系統是
-Red Hat Enterprise Linux 或 Fedora,則可以新增 <filepath>yum</filepath> 儲存庫。如果您的系統是
-Ubuntu 或 Debian,則可以新增 <filepath>deb</filepath> 儲存庫。<p>如果您正在使用
-yum 儲存庫,則可以新增 GPG 檢查以驗證此儲存庫中的某個套件是否未毀損。選取儲存庫,然後選取<uicontrol>編輯</uicontrol>。選取<uicontrol>是</uicontrol>以啟用
-GPG 檢查,然後輸入儲存庫的 GPG 金鑰檔的 URL。</p></dd>
-</dlentry><dlentry>
-<dt>除錯報告</dt>
-<dd>此區段顯示除錯報告,包括名稱和檔案路徑。您可以選取選項以產生新報告、或是重新命名、移除或下載現有報告。<p>除錯報告是使用
-<cmdname>sosreport</cmdname> 指令產生的。該指令可用於 Red
-Hat Enterprise <tm tmtype="tm" trademark="Linux">Linux</tm>、Fedora
-及 Ubuntu 發行套件。該指令會產生 .tar 檔案,其包含配置與診斷資訊,例如執行中的核心版本、已載入模組以及系統和服務配置檔案。該指令還會執行外部程式來收集更多資訊並將此輸出儲存在產生的保存檔中。</p> </dd>
-</dlentry></dl></p>
-</csbody>
-<?tm 1392659967 1?>
-</cshelp>
-
-
-<!-- ENGL1SH_VERS10N 47930_4 DO NOT REMOVE OR CHANGE THIS LINE -->
-<!-- T9N_SRC_ID 232 -->
-<!-- T9N_SH1P_STR1NG KVM21AAP001 3 -->
diff --git a/plugins/kimchi/ui/pages/host.html.tmpl b/plugins/kimchi/ui/pages/host.html.tmpl
deleted file mode 100644
index d87debc..0000000
--- a/plugins/kimchi/ui/pages/host.html.tmpl
+++ /dev/null
@@ -1,177 +0,0 @@
-#*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *#
-
-#unicode UTF-8
-#import gettext
-#from wok.cachebust import href
-#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
-#silent _ = t.gettext
-#silent _t = t.gettext
-<!DOCTYPE html>
-<html>
-<head>
-<link rel="stylesheet" href="plugins/kimchi/css/theme-default.min.css">
-<script src="plugins/kimchi/js/kimchi.min.js"></script>
-</head>
-<body>
-<div id="host-root-container">
- <div class="toolbar">
- <div class="tools">
- </div>
- </div>
- <div id="host-content-container" class="empty-when-logged-off"></div>
-</div>
-
-<script id="host-tmpl" type="kimchi/template">
- <div class="host-panel">
- <div class="logo-container">
- <div class="logo" style="background-image: url({logo});"></div>
- </div>
- <div id="host-info-container" class="info-container">
- <h2 class="hostname">{hostname}</h2>
- <div class="action-panel">
- <button id="host-button-shutdown" class="btn-normal-1 stop">
- <div class="button-icon action-icon-stop"></div>
- $_("Shut down")
- </button>
- <button id="host-button-restart" class="btn-normal-1 restart">
- <div class="button-icon action-icon-restart"></div>
- $_("Restart")
- </button>
- <button class="btn-normal-1 connect" disabled="disabled">
- <div class="button-icon action-icon-connect"></div>
- $_("Connect")
- </button>
- </div>
- <div class="host-section">
- <h3 class="section-header"
- aria-expanded="false"
- aria-controls="content-sys-info">
- $_("Basic Information")
- </h3>
- <div id="content-sys-info" class="section-content">
- <div class="section-row">
- <div class="section-label">$_("OS Distro")</div>
- <div class="section-value">{os_distro}</div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("OS Version")</div>
- <div class="section-value">{os_version}</div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("OS Code Name")</div>
- <div class="section-value">{os_codename}</div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("Processor")</div>
- <div class="section-value">{cpu_model}</div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("CPU(s)")</div>
- <div class="section-value">{cpus}</div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("Memory")</div>
- <div class="section-value">{memory}</div>
- </div>
- </div>
- </div>
- <div class="host-section">
- <h3 class="section-header"
- aria-controls="content-sys-statistics">
- $_("System Statistics")
- </h3>
- <div id="content-sys-statistics" class="section-content">
- <div class="section-row">
- <div class="section-label">$_("CPU")</div>
- <div class="section-value">
- <div id="container-chart-cpu" class="inline-block"></div>
- </div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("Memory")</div>
- <div class="section-value">
- <div id="container-chart-memory" class="inline-block"></div>
- </div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("Disk I/O")</div>
- <div class="section-value">
- <div id="container-chart-disk-io" class="inline-block"></div>
- </div>
- </div>
- <div class="section-row">
- <div class="section-label">$_("Network I/O")</div>
- <div class="section-value">
- <div id="container-chart-network-io" class="inline-block"></div>
- </div>
- </div>
- </div>
- </div>
- <div id="software-update-section" class="host-section hidden">
- <h3 class="section-header"
- aria-controls="content-software-update">
- $_("Software Updates")
- </h3>
- <div id="content-software-update" class="section-content">
- <div class="section-row">
- <div class="section-value">
- <div id="software-updates-grid-container"></div>
- <div id="software-updates-progress-container" class="hidden">
- <label for="software-updates-progress-textarea">$_("Update Progress")</label>
- <textarea id="software-updates-progress-textarea" readonly></textarea>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="repositories-section" class="host-section hidden">
- <h3 class="section-header"
- aria-controls="content-repositories">
- $_("Repositories")
- </h3>
- <div id="content-repositories" class="section-content">
- <div class="section-row">
- <div class="section-value">
- <div id="repositories-grid-container"></div>
- </div>
- </div>
- </div>
- </div>
- <div id="debug-report-section" class="host-section hidden">
- <h3 class="section-header"
- aria-controls="content-sys-reports">
- $_("Debug Reports")
- </h3>
- <div id="content-sys-reports" class="section-content">
- <div class="section-row">
- <div class="section-value">
- <div id="available-reports-grid-container"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-</script>
-
-<script type="text/javascript">
- kimchi.host_main();
-</script>
-</body>
-</html>
diff --git a/plugins/kimchi/ui/pages/i18n.json.tmpl b/plugins/kimchi/ui/pages/i18n.json.tmpl
index cd320e0..f7f557d 100644
--- a/plugins/kimchi/ui/pages/i18n.json.tmpl
+++ b/plugins/kimchi/ui/pages/i18n.json.tmpl
@@ -75,49 +75,6 @@
"KCHHOST6007M": "$_("Sent")",
"KCHHOST6008M": "$_("Shutting down or restarting host will cause unsaved work lost. Continue to shut down/restarting?")",
-
- "KCHREPO6001M": "$_("Confirm")",
- "KCHREPO6002M": "$_("Repository will be removed permanently and can't be recovered. Do you want to continue?")",
- "KCHREPO6003M": "$_("Repositories")",
- "KCHREPO6004M": "$_("ID")",
- "KCHREPO6005M": "$_("Name")",
- "KCHREPO6006M": "$_("Base URL")",
- "KCHREPO6007M": "$_("Is Mirror")",
- "KCHREPO6008M": "$_("URL Args")",
- "KCHREPO6009M": "$_("Enabled")",
- "KCHREPO6010M": "$_("GPG Check")",
- "KCHREPO6011M": "$_("GPG Key")",
- "KCHREPO6012M": "$_("Add")",
- "KCHREPO6013M": "$_("Edit")",
- "KCHREPO6014M": "$_("Remove")",
- "KCHREPO6016M": "$_("Enable")",
- "KCHREPO6017M": "$_("Disable")",
-
-
- "KCHUPD6001M": "$_("Software Updates")",
- "KCHUPD6002M": "$_("Package Name")",
- "KCHUPD6003M": "$_("Version")",
- "KCHUPD6004M": "$_("Architecture")",
- "KCHUPD6005M": "$_("Repository")",
- "KCHUPD6006M": "$_("Update All")",
- "KCHUPD6007M": "$_("Updating...")",
- "KCHUPD6008M": "$_("Failed to retrieve packages update information.")",
- "KCHUPD6009M": "$_("Failed to update package(s).")",
-
-
- "KCHDR6001M": "$_("Debug report will be removed permanently and can't be recovered. Do you want to continue?")",
- "KCHDR6002M": "$_("Debug Reports")",
- "KCHDR6003M": "$_("Name")",
- "KCHDR6005M": "$_("Generated Time")",
- "KCHDR6006M": "$_("Generate")",
- "KCHDR6007M": "$_("Generating...")",
- "KCHDR6008M": "$_("Rename")",
- "KCHDR6009M": "$_("Remove")",
- "KCHDR6010M": "$_("Download")",
- "KCHDR6011M": "$_("Report name should contain only letters, digits, underscore ('_') and/or hyphen ('-').")",
- "KCHDR6012M": "$_("Pending...")",
- "KCHDR6013M": "$_("Report name is the same as the original one.")",
-
"KCHVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
"KCHVM6002M": "$_("Power off Confirmation")",
"KCHVM6003M": "$_("This action may produce undesirable results, "
diff --git a/plugins/kimchi/ui/pages/report-add.html.tmpl b/plugins/kimchi/ui/pages/report-add.html.tmpl
deleted file mode 100644
index 25bf0a9..0000000
--- a/plugins/kimchi/ui/pages/report-add.html.tmpl
+++ /dev/null
@@ -1,56 +0,0 @@
-#*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *#
-#unicode UTF-8
-#import gettext
-#from wok.cachebust import href
-#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
-#silent _ = t.gettext
-#silent _t = t.gettext
-<!DOCTYPE html>
-<div id="report-add-window" class="window">
- <header>
- <h1 class="title h1 grey">$_("Generate a New Debug Report")</h1>
- </header>
- <div class="content">
- <form id="form-report-add">
- <section class="form-section">
- <h2>
- <label for="report-name-textbox">$_("Report Name")</label>
- </h2>
- <div class="field">
- <input type="text" class="text" id="report-name-textbox" name="name" />
- <span class="icon-info-circled light-grey c1"></span>
- <span class="info-add-debug-report">
- $_("The name used to identify the report. If omitted, a name will be chosen based on current time. Name can contain: letters, digits, underscore (\"_\") and hyphen (\"-\").")
- </span>
- </div>
- </section>
- </form>
- </div>
- <footer>
- <div class="btn-group">
- <button id="button-report-add" class="btn-normal"><span class="text">$_("Generate")</span></button>
- <button id="button-report-cancel" class="btn-normal close" type="button">
- <span calss="text">$_("Cancel")</span>
- </button>
- </div>
- </footer>
-</div>
-<script>
- kimchi.report_add_main();
-</script>
diff --git a/plugins/kimchi/ui/pages/report-rename.html.tmpl b/plugins/kimchi/ui/pages/report-rename.html.tmpl
deleted file mode 100644
index 90a0a80..0000000
--- a/plugins/kimchi/ui/pages/report-rename.html.tmpl
+++ /dev/null
@@ -1,56 +0,0 @@
-#*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *#
-#unicode UTF-8
-#import gettext
-#from wok.cachebust import href
-#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
-#silent _ = t.gettext
-#silent _t = t.gettext
-<!DOCTYPE html>
-<div id="report-rename-window" class="window">
- <header>
- <h1 class="title h1 grey">$_("Rename a Debug Report")</h1>
- </header>
- <div class="content">
- <form id="form-report-rename">
- <section class="form-section">
- <h2>
- <label for="report-name-textbox">$_("Report Name")</label>
- </h2>
- <div class="field">
- <input type="text" class="text" id="report-name-textbox" name="name" />
- <span class="icon-info-circled light-grey c1"></span>
- <span class="info-debug-report-rename">
- $_("The name used to identify the report. Name can contain: letters, digits and hyphen (\"-\").")
- </span>
- </div>
- </section>
- </form>
- </div>
- <footer>
- <div class="btn-group">
- <button id="button-report-rename" class="btn-normal"><span class="text">$_("Submit")</span></button>
- <button id-"button-report-rename-cancel" class="btn-normal close" type="button">
- <span class="text">$_("Cancel")</span>
- </button>
- </div>
- </footer>
-</div>
-<script>
- kimchi.report_rename_main();
-</script>
diff --git a/plugins/kimchi/ui/pages/repository-add.html.tmpl b/plugins/kimchi/ui/pages/repository-add.html.tmpl
deleted file mode 100644
index 950252a..0000000
--- a/plugins/kimchi/ui/pages/repository-add.html.tmpl
+++ /dev/null
@@ -1,113 +0,0 @@
-#*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *#
-#unicode UTF-8
-#import gettext
-#from wok.cachebust import href
-#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
-#silent _ = t.gettext
-#silent _t = t.gettext
-<div id="repository-add-window" class="window">
- <form id="form-repository-add">
- <header class="window-header">
- <h1 class="title h1 grey">$_("Add a Repository")</h1>
- </header>
- <section>
- <div class="content">
- <div class="form-section yum">
- <h2>$_("Identifier")</h2>
- <div class="field">
- <div class="textbox-wrapper">
- <input type="text" class="text" name="repo_id" />
- </div>
- <div class="icon-info-circled light-grey c1 help-inline"></div>
- <p class="text-help help-inline">
- $_("Single word, unique identifier for the repository.")
- </p>
- </div>
- </div>
- <section class="form-section yum">
- <h2>$_("Name")</h2>
- <div class="field">
- <div class="textbox-wrapper">
- <input type="text" class="text" name="config[repo_name]" />
- </div>
- <div class="icon-info-circled light-grey c1 help-inline"></div>
- <p class="text-help help-inline">
- $_("Textual name for the repository.")
- </p>
- </div>
- </section>
- <section class="form-section">
- <h2>$_("URL")<span class="required" role="presentation" title='$_("Required Field")'>*</span></h2>
- <div class="field">
- <div class="textbox-wrapper">
- <input type="text" class="text required" name="baseurl" />
- </div>
- <div class="icon-info-circled light-grey c1 help-inline"></div>
- <p class="text-help help-inline">
- $_("URL to the repository. Supported protocols are http, ftp, and file.")
- </p>
- </div>
- <div class="field yum">
- <p class="yum">
- <input type="checkbox" name="isMirror" value="true" id="isMirror" />
- <label id="isMirrorLabel" for="isMirror">$_("Repository is a mirror")</label>
- </p>
- </div>
- </section>
- <section class="form-section repository-dist deb">
- <h2>$_("Distribution")</h2>
- <div class="field">
- <div class="textbox-wrapper">
- <input type="text" class="text" name="config[dist]" />
- </div>
- <div class="icon-info-circled light-grey c1 help-inline"></div>
- <p class="text-help help-inline">
- $_("Distribution of the DEB repository.")
- </p>
- </div>
- </section>
- <section class="form-section repository-comps deb">
- <h2>$_("Components")</h2>
- <div class="field">
- <div class="textbox-wrapper">
- <input type="text" class="text" name="config[comps]" />
- </div>
- <div class="icon-info-circled light-grey c1 help-inline"></div>
- <p class="text-help help-inline">
- $_("List of components in DEB repository.")
- </p>
- </div>
- </section>
- </div>
- </section>
- <footer>
- <div class="btn-group">
- <button type="submit" id="button-repository-add" class="btn-normal" disabled="disabled">
- <span class="text">$_("Add")</span>
- </button>
- <button type="button" id="button-repository-close" class="btn-normal close">
- <span class="text">$("Cancel")</span>
- </button>
- </div>
- </footer>
- </form>
-</div>
-<script>
- kimchi.repository_add_main();
-</script>
diff --git a/plugins/kimchi/ui/pages/repository-edit.html.tmpl b/plugins/kimchi/ui/pages/repository-edit.html.tmpl
deleted file mode 100644
index e5a3cfb..0000000
--- a/plugins/kimchi/ui/pages/repository-edit.html.tmpl
+++ /dev/null
@@ -1,117 +0,0 @@
-#*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2014-2015
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *#
-#unicode UTF-8
-#import gettext
-#from wok.cachebust import href
-#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang, fallback=True)
-#silent _ = t.gettext
-#silent _t = t.gettext
-
-<div id="repository-edit-window" class="window">
- <form id="form-repository-edit">
- <header>
- <h1 class="title h1 grey">$_("Edit Repository")</h1>
- </header>
- <div class="content">
- <section id="form-repository-edit">
- <fieldset class="repository-edit-fieldset">
- <div class="repository-id yum">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-id-textbox">$_("ID")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-id-textbox" name="repo_id" type="text" disabled="disabled" readonly="readonly"/>
- </div>
- </div>
- <div class="repository-name yum">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-name-textbox">$_("Name")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-name-textbox" class="yum" name="config[repo_name]" type="text" />
- </div>
- </div>
- <div class="repository-url">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-baseurl-textbox">$_("URL")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-baseurl-textbox" name="baseurl" type="text" />
- </div>
- </div>
- <div class="repository-dist deb">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-urlargs-textbox">$_("Distribution")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-urlargs-textbox" class="deb" name="config[dist]" type="text" />
- </div>
- </div>
- <div class="repository-mirrorlist yum">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-urlargs-textbox">$_("Mirror List URL")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-urlargs-textbox" class="yum" name="config[mirrorlist]" type="text" />
- </div>
- </div>
- <div class="repository-comps deb">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-urlargs-textbox">$_("Components")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-urlargs-textbox" class="deb" name="config[comps]" type="text" />
- </div>
- </div>
- <div class="repository-gpgkey yum">
- <div class="repository-edit-wrapper-label">
- <label for="repository-edit-gpgkey-textbox">$_("GPG Key")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-gpgkey-textbox" class="yum" name="config[gpgkey]" type="text" />
- </div>
- </div>
- <div class="repository-gpgcheck yum">
- <div class="repository-edit-wrapper-label">
- <label>$_("GPG Check")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-gpgcheck-radio-true" class="yum" name="config[gpgcheck]" type="radio" value="true" />
- <label for="repository-edit-gpgcheck-radio-true">$_("Yes")</label>
- <input id="repository-edit-gpgcheck-radio-false" class="yum" name="config[gpgcheck]" type="radio" value="false" />
- <label for="repository-edit-gpgcheck-radio-false">$_("No")</label>
- </div>
- </div>
- </fieldset>
- </section>
- </div>
- <footer>
- <div class="btn-group">
- <button type="submit" id="repository-edit-button-save" class="btn-normal">
- <span class="text">$_("Save")</span>
- </button>
- <button type="button" id="repository-edit-button-cancel" class="close btn-normal">
- <span class="text">$_("Cancel")</span>
- </button>
- </div>
- </footer>
- </form>
-</div>
-<script type="text/javascript">
- kimchi.repository_edit_main();
-</script>
diff --git a/plugins/kimchi/yumparser.py b/plugins/kimchi/yumparser.py
deleted file mode 100644
index 74f9fa0..0000000
--- a/plugins/kimchi/yumparser.py
+++ /dev/null
@@ -1,283 +0,0 @@
-#
-# Project Kimchi
-#
-# Copyright IBM, Corp. 2015
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-import subprocess
-from os import listdir
-from os.path import isfile, splitext
-
-
-class YumRepoObject(object):
-
- def __init__(self, repo_id, repofile):
- self.repo_id = repo_id
- self.name = None
- self.baseurl = None
- self.enabled = True
- self.gpgcheck = True
- self.gpgkey = None
- self.metalink = None
- self.mirrorlist = None
- self.repofile = repofile
- self.string_attrs = ['baseurl', 'gpgkey', 'name',
- 'metalink', 'mirrorlist']
- self.boolean_attrs = ['enabled', 'gpgcheck']
-
- def set_attribute(self, key, strvalue):
- if key in self.string_attrs:
- setattr(self, key, strvalue)
- elif key in self.boolean_attrs:
- setattr(self, key, (strvalue == '1'))
-
- def get_attribute_str(self, key):
- if key not in self.get_attributes():
- return None
-
- if key in self.boolean_attrs:
- str_value = '1' if getattr(self, key) is True else '0'
- else:
- str_value = getattr(self, key)
-
- if str_value is None:
- return None
-
- return key + '=' + str_value
-
- def get_attributes(self):
- return self.string_attrs + self.boolean_attrs
-
- def enable(self):
- self.enabled = True
-
- def disable(self):
- self.enabled = False
-
- def __str__(self):
- str_obj = '[' + self.repo_id + ']' + '\n'
- for key in self.get_attributes():
- if self.get_attribute_str(key) is not None:
- str_obj += self.get_attribute_str(key) + '\n'
- return str_obj
-
-
-def get_repo_files():
- def _is_repository_file(f):
- _, f_extension = splitext(f)
- return isfile(f) and (f_extension == '.repo')
-
- YUM_REPO_DIR = '/etc/yum.repos.d'
- return [YUM_REPO_DIR+'/'+f for f in listdir(YUM_REPO_DIR)
- if _is_repository_file(YUM_REPO_DIR+'/'+f)]
-
-
-def _ignore_line_repo_file(line):
- return line.startswith("#") or '=' not in line
-
-
-def _get_repos_from_file(repo_file):
- repos_from_file = {}
- current_repo = None
- current_repo_id = None
- with open(repo_file) as f:
- for line in f.readlines():
- line = line.strip()
- if line.startswith("["):
- if current_repo is not None:
- repos_from_file[current_repo_id] = current_repo
- current_repo_id = line.strip('[]')
- current_repo = YumRepoObject(current_repo_id, repo_file)
- continue
- if _ignore_line_repo_file(line):
- continue
- key, value = line.split('=', 1)
- key = key.strip()
- value = value.strip()
- current_repo.set_attribute(key, value)
-
- # add the last repo from file.
- if current_repo is not None:
- repos_from_file[current_repo_id] = current_repo
-
- return repos_from_file
-
-
-def get_yum_repositories():
- repo_files = get_repo_files()
- repos = {}
- for yum_repo in repo_files:
- repos.update(_get_repos_from_file(yum_repo))
-
- return repos
-
-
-def _retrieve_repo_line_index(data, repo):
- repo_entry = '[' + repo.repo_id + ']\n'
- try:
- repo_index = data.index(repo_entry)
- except:
- return None
- return repo_index
-
-
-def _update_repo_file_data(data, repo, repo_index):
- remaining_repo_attrs = repo.get_attributes()
-
- for i in range(repo_index + 1, len(data)):
- line = data[i].strip()
- if line.startswith('['):
- break
- if _ignore_line_repo_file(line):
- continue
- key, _ = line.split('=', 1)
- key = key.strip()
- attr_str = repo.get_attribute_str(key)
- if attr_str is None:
- continue
- remaining_repo_attrs.remove(key)
- data[i] = attr_str + '\n'
-
- for attr in remaining_repo_attrs:
- attr_str = repo.get_attribute_str(attr)
- if attr_str is None:
- continue
- data.insert(repo_index+1, attr_str + '\n')
-
- return data
-
-
-def write_repo_to_file(repo):
- with open(repo.repofile) as f:
- data = f.readlines()
-
- repo_index = _retrieve_repo_line_index(data, repo)
- if repo_index is None:
- return
-
- data = _update_repo_file_data(data, repo, repo_index)
-
- with open(repo.repofile, 'w') as f:
- f.writelines(data)
-
-
-def _get_last_line_repo(data, repo_index):
- stop_delete_index = None
- for i in range(repo_index+1, len(data)):
- line = data[i].strip()
- if line.startswith('['):
- stop_delete_index = i - 1
- break
- if stop_delete_index is None:
- stop_delete_index = len(data) - 1
-
- return stop_delete_index
-
-
-def _remove_repo_file_data(data, repo_index):
- last_line_repo = _get_last_line_repo(data, repo_index)
- for i in range(last_line_repo, repo_index - 1, -1):
- data.pop(i)
- return data
-
-
-def delete_repo_from_file(repo):
- with open(repo.repofile) as f:
- data = f.readlines()
-
- repo_index = _retrieve_repo_line_index(data, repo)
- if repo_index is None:
- return
-
- data = _remove_repo_file_data(data, repo_index)
-
- with open(repo.repofile, 'w') as f:
- f.writelines(data)
-
-
-class YumUpdatePackageObject(object):
-
- def __init__(self, name, arch, version, repo):
- self.name = name
- self.arch = arch
- self.version = version
- self.ui_from_repo = repo
-
-
-def _include_line_checkupdate_output(line):
- tokens = line.split()
-
- if len(tokens) != 3:
- return False
-
- if '.' not in tokens[0]:
- return False
-
- return True
-
-
-def _ignore_obsoleting_packages_in(output):
- out = ''
- for l in output.split('\n'):
- if 'Obsoleting ' in l:
- break
- out += l + '\n'
- return out
-
-
-def _filter_lines_checkupdate_output(output):
- if output is None:
- return []
-
- output = _ignore_obsoleting_packages_in(output)
-
- out = [l for l in output.split('\n')
- if _include_line_checkupdate_output(l)]
- return out
-
-
-def _get_yum_checkupdate_output():
- cmd = ['yum', 'check-update', '-d0']
- yum_update_cmd = subprocess.Popen(cmd,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- out, error = yum_update_cmd.communicate()
- return_code = yum_update_cmd.returncode
- if return_code == 1:
- return None
-
- return out
-
-
-def get_yum_packages_list_update(checkupdate_output=None):
- if checkupdate_output is None:
- checkupdate_output = _get_yum_checkupdate_output()
-
- filtered_output = _filter_lines_checkupdate_output(checkupdate_output)
-
- packages = []
- for line in filtered_output:
- line = line.split()
- index = 0
- name_arch = line[index]
- index += 1
- version = line[index]
- index += 1
- repo = line[index]
- name, arch = name_arch.rsplit('.', 1)
- packages.append(YumUpdatePackageObject(name, arch, version, repo))
-
- return packages
--
2.1.0
More information about the Kimchi-devel
mailing list