[PATCH][Wok 2/5] Creates pluginmanager.py module
by Rodrigo Trujillo
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/wok/pluginsmanager.py | 133 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)
create mode 100644 src/wok/pluginsmanager.py
diff --git a/src/wok/pluginsmanager.py b/src/wok/pluginsmanager.py
new file mode 100644
index 0000000..b7bb92b
--- /dev/null
+++ b/src/wok/pluginsmanager.py
@@ -0,0 +1,133 @@
+#
+# Project Wok
+#
+# Copyright IBM Corp, 2016
+#
+# Code derived from Project Kimchi
+#
+# 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 cherrypy
+import copy
+import os
+from cherrypy.lib.reprconf import Parser
+from configobj import ConfigObj
+
+
+from basemodel import Singleton
+from wok.config import paths, PluginConfig, PluginPaths
+from wok.exception import OperationFailed
+
+
+wok_log = cherrypy.log.error_log
+
+
+class Plugins():
+ __metaclass__ = Singleton
+
+ def __init__(self):
+ # { '<PLUGIN_NAME>': {
+ # config: <PLUGIN_CONFIG>,
+ # enabled: <TRUE/FALSE>,
+ # uri: <PLUGIN_URI_FROM_CONFIG>,
+ # plugin_class: <PLUGIN_CLASS_FROM_CONFIG>
+ self._plugins_dict = {}
+ self._init_all_plugins()
+
+ def _load_plugin_conf(self, name):
+ plugin_conf = PluginPaths(name).conf_file
+ ret = {}
+ if not os.path.exists(plugin_conf):
+ cherrypy.log.error_log.error("Plugin configuration file %s"
+ " doesn't exist." % plugin_conf)
+ else:
+ try:
+ ret = Parser().dict_from_file(plugin_conf)
+ except ValueError as e:
+ msg = "Failed to load plugin conf from %s: %s"
+ cherrypy.log.error_log.error(msg % (plugin_conf, e.message))
+ ret.update(PluginConfig(name))
+ return ret
+
+ def _init_all_plugins(self):
+ plugin_dir = paths.plugins_dir
+ try:
+ dir_contents = os.listdir(plugin_dir)
+ except OSError:
+ return
+ for name in dir_contents:
+ if os.path.isdir(os.path.join(plugin_dir, name)):
+ wok_log.info("Loading plugin: %s" % name)
+ cfg = self._load_plugin_conf(name)
+ plugin_cls = cfg.get('wok', {}).get('plugin_class', '')
+ if plugin_cls == '':
+ plugin_cls = ('plugins.%s.%s' % (name, name[0].upper() +
+ name[1:]))
+ self._plugins_dict[name] = {
+ 'config': cfg,
+ 'enabled': cfg.get('wok', {}).get('enable', False),
+ 'uri': cfg.get('wok', {}).get('uri', ''),
+ 'plugin_class': plugin_cls,
+ 'conf_file': PluginPaths(name).conf_file
+ }
+
+ if 'wok' in self._plugins_dict[name]['config']:
+ del self._plugins_dict[name]['config']['wok']
+
+ def get_all_plugins_info(self):
+ return copy.deepcopy(self._plugins_dict)
+
+ def get_plugin_info(self, name):
+ return copy.deepcopy(self._plugins_dict.get(name, {}))
+
+ def get_all_plugins_names(self):
+ ret = self._plugins_dict.keys()
+ ret.sort()
+ return ret
+
+ def get_enabled_plugins(self):
+ ret = [plugin for plugin in self._plugins_dict.keys() if
+ self._plugins_dict[plugin]['enabled']]
+ ret.sort()
+ return ret
+
+ def _enable_plugin_conf_file(self, f_conf, enable=True):
+ try:
+ # 'unrepr' makes ConfigObj read and write characters like ("'?)
+ conf = ConfigObj(infile=f_conf, unrepr=True)
+ conf['wok']['enable'] = enable
+ with open(f_conf, 'wb') as f:
+ conf.write(f)
+ except Exception as e:
+ wok_log.error('Error updating plugin conf file. ' + e.message)
+ raise
+
+ def _change_plugin_state(self, name, enable=True):
+ plugin = self._plugins_dict[name]
+ if plugin['enabled'] == enable:
+ return
+ try:
+ self._enable_plugin_conf_file(plugin['conf_file'], enable)
+ except:
+ raise OperationFailed('WOKPLUG0002E', {'plugin': name})
+ plugin['enabled'] = enable
+
+ def enable_plugin(self, plugin):
+ self._change_plugin_state(plugin, True)
+
+ def disable_plugin(self, plugin):
+ self._change_plugin_state(plugin, False)
--
2.1.0
8 years, 7 months
[PATCH][Wok 1/5] Adapt Wok UI to new Plugins API returns
by Rodrigo Trujillo
This patch avoids error in UI due to changes in Plugins API.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/js/src/wok.api.js | 2 +-
ui/js/src/wok.logos.js | 10 +++++++---
ui/js/src/wok.main.js | 8 ++++++--
ui/js/wok.user-log.js | 3 ++-
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/ui/js/src/wok.api.js b/ui/js/src/wok.api.js
index 5238594..5b7e09a 100644
--- a/ui/js/src/wok.api.js
+++ b/ui/js/src/wok.api.js
@@ -99,7 +99,7 @@ var wok = {
listPlugins : function(suc, err, sync) {
wok.requestJSON({
- url : 'plugins',
+ url : 'pluginsmanager',
type : 'GET',
contentType : 'application/json',
dataType : 'json',
diff --git a/ui/js/src/wok.logos.js b/ui/js/src/wok.logos.js
index a825108..98dcf5c 100644
--- a/ui/js/src/wok.logos.js
+++ b/ui/js/src/wok.logos.js
@@ -78,18 +78,22 @@ wok.logos = function(element, powered) {
wok.listPlugins(function(plugins) {
if(plugins && plugins.length > 0) {
$(plugins).each(function(i, p) {
+ if (p.enabled == false) {
+ // Skip
+ return true;
+ }
var url = wok.substitute(pluginUrl, {
- plugin: p
+ plugin: p.name
});
obj[i] = {
- name : p
+ name : p.name
}
var pluginVersions;
pluginVersions = retrieveVersion(url);
if(pluginVersions && pluginVersions.length > 0){
obj[i].version = pluginVersions;
}
- var imagepath = url+'/images/'+p;
+ var imagepath = url+'/images/'+p.name;
if(checkImage(imagepath+'.svg') == 200) {
obj[i].image = imagepath+'.svg';
}
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index 2146b3d..fcb7d84 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -129,11 +129,15 @@ wok.main = function() {
var wokTabs = retrieveTabs(wokConfigUrl);
wok.listPlugins(function(plugins) {
$(plugins).each(function(i, p) {
+ if (p.enabled == false) {
+ // Skip plugin
+ return true;
+ }
var url = wok.substitute(pluginConfigUrl, {
- plugin: p
+ plugin: p.name
});
var i18nUrl = wok.substitute(pluginI18nUrl, {
- plugin: p
+ plugin: p.name
});
wok.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)},
function(i18nObj){ //i18n is not define by plugin
diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
index e787ee6..2c58827 100644
--- a/ui/js/wok.user-log.js
+++ b/ui/js/wok.user-log.js
@@ -170,7 +170,8 @@ wok.initUserLogWindow = function() {
var pluginsData = [];
wok.listPlugins(function(pluginReturn) {
$.each(pluginReturn, function(i, obj) {
- pluginsData.push({"app": obj});
+ if (obj.enabled == false) { return true; }
+ pluginsData.push({"app": obj.name});
});
pluginsData.unshift({"app": "wok"});
var pluginsTt = new Bloodhound({
--
2.1.0
8 years, 7 months
[PATCH][Wok 0/5] Basic support to enable/disable plugins
by Rodrigo Trujillo
V1:
This is initial basic version of Plugins Manager.
Features:
- Improve plugins load and initialization;
- New API to enable/disable a given plugin;
- Update plugin configuration file;
- Fix UI in order make Wok work as usual;
ToDos (improvements):
- Implement automated test cases;
- Update (enable/disable) plugin in cherrypy (live);
- Support to plugins dependencies;
Rodrigo Trujillo (5):
Adapt Wok UI to new Plugins API returns
Creates pluginmanager.py module
Changes server behavior to use pluginsmanager
Implements control/model of new plugin API
Change plugins API documentation by pluginsmanager API
docs/API/plugins.md | 13 -----
docs/API/pluginsmanager.md | 61 +++++++++++++++++++++
src/wok/control/plugins.py | 19 ++++++-
src/wok/i18n.py | 3 +
src/wok/model/plugins.py | 30 ++++++++--
src/wok/pluginsmanager.py | 133 +++++++++++++++++++++++++++++++++++++++++++++
src/wok/server.py | 32 ++++++-----
src/wok/utils.py | 36 +-----------
ui/js/src/wok.api.js | 2 +-
ui/js/src/wok.logos.js | 10 +++-
ui/js/src/wok.main.js | 8 ++-
ui/js/wok.user-log.js | 3 +-
12 files changed, 273 insertions(+), 77 deletions(-)
delete mode 100644 docs/API/plugins.md
create mode 100644 docs/API/pluginsmanager.md
create mode 100644 src/wok/pluginsmanager.py
--
2.1.0
8 years, 7 months
Re: [Kimchi-devel] [PATCH V2][Wok 00/12] FVT testcases wok framework
by Lucio Correia
Reviewed-By: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
On 31-05-2016 03:53, Archana Singh wrote:
>
>
> On 5/30/2016 11:08 PM, Lucio Correia wrote:
>> I'm getting 0 tests ran in my F23 x86, is that correct?
> Yes, as currently we do not have any fvt testcases added. It just a
> framework. Once this framework in place, testcases can be added.
>>
>> $ make check-fvt
>> ./run_tests.sh
>> New python executable in /home/dev/wok/tests/fvt/venv/bin/python
>> Installing setuptools, pip, wheel...done.
>> Collecting jsonschema (from -r
>> /home/dev/wok/tests/fvt/requirements.txt (line 22))
>> Downloading jsonschema-2.5.1-py2.py3-none-any.whl
>> Collecting requests (from -r /home/dev/wok/tests/fvt/requirements.txt
>> (line 23))
>> Downloading requests-2.10.0-py2.py3-none-any.whl (506kB)
>> 100% |████████████████████████████████| 512kB 2.2MB/s
>> Collecting functools32; python_version == "2.7" (from jsonschema->-r
>> /home/dev/wok/tests/fvt/requirements.txt (line 22))
>> Downloading functools32-3.2.3-2.zip
>> Building wheels for collected packages: functools32
>> Running setup.py bdist_wheel for functools32 ... done
>> Stored in directory:
>> /home/dev/.cache/pip/wheels/3c/d0/09/cd78d0ff4d6cfecfbd730782a7815a4571cd2cd4d2ed6e69d9
>>
>> Successfully built functools32
>> Installing collected packages: functools32, jsonschema, requests
>> Successfully installed functools32-3.2.3.post2 jsonschema-2.5.1
>> requests-2.10.0
>>
>> ----------------------------------------------------------------------
>> Ran 0 tests in 0.000s
>>
>> OK
>> rm -fr venv
>>
>>
>> On 30-05-2016 04:10, archus(a)linux.vnet.ibm.com wrote:
>>> From: Archana Singh <archus(a)linux.vnet.ibm.com>
>>>
>>> Patch for adding FVT testcases wok framework which can be used across
>>> plugins.
>>> The changes are:
>>> 1) Added fvt package inside tests directory.
>>> 2) Added config file inside fvt package to have session details.
>>> 3) restapilib.py to have common classes/methods for REST API calls.
>>> 4) fvt_base.py, a base test class to take care of doing
>>> common setup and treadown required for any fvt test cases like
>>> creating/destroying session using config file and restapilib.py.
>>> 5) run_test.sh.in script to install all the dependencies and to run
>>> all FVT.
>>> 6) make file changes to have 'make check-fvt' for running all the FVT.
>>> 7) Instruction added in REDME.md for make check-fvt.
>>> 8) Added tests/fvt/config into IBM license blacklist.
>>>
>>> Archana Singh (12):
>>> FVT: Package for functional verification testcases.
>>> FVT: Wok level config file to have 'sectionsi required for fvt common
>>> across plugins.
>>> FVT: Lists all dependecies for fvt testcases.
>>> FVT: Common classes/methods for API calls as per config file
>>> configuration.
>>> FVT: Base test class, takes care common actions required for any FVT
>>> test cases.
>>> FVT: Install all the dependencies from requirements.txt and runs FVT
>>> testcases
>>> FVT: Makefile needed for build and run fvt.
>>> FVT: Added fvt as subdirs and check-fvt to run fvt testcases using
>>> make.
>>> FVT: Added FVT Makefile path in AC_CONFIG_FILES list.
>>> FVT: Added check-fvt to run FVT testcases using make and venv dir to
>>> be cleaned.
>>> FVT: Added Readme instruction for running fvt testcases.
>>> Added tests/fvt/config file into backlist.
>>>
>>> IBM-license-blacklist | 1 +
>>> Makefile.am | 6 +
>>> configure.ac | 1 +
>>> docs/README.md | 8 +
>>> tests/Makefile.am | 7 +
>>> tests/fvt/Makefile.am | 43 +++
>>> tests/fvt/__init__.py | 18 ++
>>> tests/fvt/config | 7 +
>>> tests/fvt/fvt_base.py | 92 ++++++
>>> tests/fvt/requirements.txt | 23 ++
>>> tests/fvt/restapilib.py | 738
>>> +++++++++++++++++++++++++++++++++++++++++++++
>>> tests/fvt/run_tests.sh.in | 92 ++++++
>>> 12 files changed, 1036 insertions(+)
>>> create mode 100644 tests/fvt/Makefile.am
>>> create mode 100644 tests/fvt/__init__.py
>>> create mode 100644 tests/fvt/config
>>> create mode 100644 tests/fvt/fvt_base.py
>>> create mode 100644 tests/fvt/requirements.txt
>>> create mode 100644 tests/fvt/restapilib.py
>>> create mode 100755 tests/fvt/run_tests.sh.in
>>>
>>
>>
>
--
Lucio Correia
Software Engineer
IBM LTC Brazil
8 years, 7 months
Re: [Kimchi-devel] [PATCH] [Kimchi] Properly display network interfaces when more than one exists
by Socorro Stoppler
Did you make sure and build the css? Thanks!
On 05/30/2016 07:37 PM, Aline Manera wrote:
> Hi Socorro,
>
> I tried again and I was not able to get the 'unavailable' on
> interfaces neither.
> But the interface list only display one interface right after the
> network creation. Only when I switched tabs, I could see more
> interfaces listed there.
>
>
>
>
> On 05/27/2016 07:37 PM, Socorro Stoppler wrote:
>> Hi Aline,
>>
>> I tried this w/a test env (i.e. --test) so I could have an interface
>> and when I created a VEPA network, it showed the interface. What
>> showed up as unavailable was the Address Space column. Would you
>> mind sending me a picture?
>>
>> Thanks
>> -Socorro
>>
>> On 05/27/2016 12:36 PM, Aline Manera wrote:
>>>
>>> Hi Socorro,
>>>
>>> 1. Once I create a VEPA or Passthrough Bridged network, the
>>> interface column displays "unavailable". If I switch tabs and go
>>> back to Network tab, the interface column displays the interface
>>> values as proposed by this patch.
>>>
>>> 2. I'd suggest to rename the variable name to 'interfaces' just to
>>> reflect that this field can list multiple values.
>>>
>>> Regards,
>>> Aline Manera
>>>
>>> On 05/25/2016 03:03 PM, Socorro Stoppler wrote:
>>>> This patch fixes a bug in the listing of networks in that only one
>>>> network
>>>> interface is being shown regardless of the number of interfaces
>>>> that exist for
>>>> that network.
>>>>
>>>> In addition to now displaying all of the interfaces, in the case
>>>> that there's too many to fit in the column, an ellipsis has been
>>>> added to indicate
>>>> that there's more interfaces than what it being shown. A tooltip
>>>> will be seen when
>>>> the user hovers over the interface(s) to show all of the interfaces.
>>>>
>>>>
>>>> Signed-off-by: Socorro Stoppler <socorro(a)linux.vnet.ibm.com>
>>>> ---
>>>> ui/css/kimchi.css | 8 ++++++--
>>>> ui/css/src/modules/_network.scss | 9 ++++++---
>>>> ui/js/src/kimchi.network.js | 4 +++-
>>>> ui/pages/tabs/network.html.tmpl | 4 ++--
>>>> 4 files changed, 17 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/ui/css/kimchi.css b/ui/css/kimchi.css
>>>> index 49ea39a..72f340c 100644
>>>> --- a/ui/css/kimchi.css
>>>> +++ b/ui/css/kimchi.css
>>>> @@ -2156,12 +2156,16 @@ body.wok-gallery {
>>>>
>>>> #network-root-container .wok-datagrid > .wok-datagrid-header >
>>>> span.column-interface,
>>>> #network-root-container .wok-datagrid > .wok-datagrid-body >
>>>> .wok-datagrid-row > span.column-interface {
>>>> - width: 10.3896%;
>>>> + width: 15.3896%;
>>>> + padding-right: 40px;
>>>> + white-space: nowrap;
>>>> + overflow: hidden;
>>>> + text-overflow: ellipsis;
>>>> }
>>>>
>>>> #network-root-container .wok-datagrid > .wok-datagrid-header >
>>>> span.column-space,
>>>> #network-root-container .wok-datagrid > .wok-datagrid-body >
>>>> .wok-datagrid-row > span.column-space {
>>>> - width: 30%;
>>>> + width: 25%;
>>>> }
>>>>
>>>> #network-root-container .wok-datagrid > .wok-datagrid-header >
>>>> span.column-action,
>>>> diff --git a/ui/css/src/modules/_network.scss
>>>> b/ui/css/src/modules/_network.scss
>>>> index 4627ab5..ab47c89 100644
>>>> --- a/ui/css/src/modules/_network.scss
>>>> +++ b/ui/css/src/modules/_network.scss
>>>> @@ -93,18 +93,21 @@
>>>> }
>>>>
>>>> > span.column-interface {
>>>> - width: 10.3896%;
>>>> + width: 15.3896%;
>>>> + padding-right: 40px;
>>>> + white-space: nowrap;
>>>> + overflow: hidden;
>>>> + text-overflow: ellipsis;
>>>> }
>>>>
>>>> > span.column-space {
>>>> - width: 30%;
>>>> + width: 25%;
>>>> }
>>>>
>>>> > span.column-action {
>>>> width: 25.909%;
>>>> text-align: right;
>>>> }
>>>> -
>>>> }
>>>>
>>>> .wok-datagrid > .wok-datagrid-body > .wok-datagrid-row > span {
>>>> diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
>>>> index 381449d..ac6bf74 100644
>>>> --- a/ui/js/src/kimchi.network.js
>>>> +++ b/ui/js/src/kimchi.network.js
>>>> @@ -35,6 +35,7 @@ kimchi.initNetwork = function() {
>>>> kimchi.initNetworkListView = function() {
>>>> $('.wok-mask').removeClass('hidden');
>>>> kimchi.listNetworks(function(data) {
>>>> + $('[data-toggle="tooltip"]').tooltip();
>>>> for (var i = 0; i < data.length; i++) {
>>>> var network = {
>>>> name : data[i].name,
>>>> @@ -46,7 +47,8 @@ kimchi.initNetworkListView = function() {
>>>> } else {
>>>> network.type = data[i].connection;
>>>> }
>>>> - network.interface = data[i].interfaces ?
>>>> data[i].interfaces[0] : null;
>>>> + network.interface = data[i].interfaces ?
>>>> data[i].interfaces : null;
>>>> + network.interface.join();
>>>> network.addrSpace = data[i].subnet ? data[i].subnet :
>>>> null;
>>>> network.persistent = data[i].persistent;
>>>> kimchi.addNetworkItem(network);
>>>> diff --git a/ui/pages/tabs/network.html.tmpl
>>>> b/ui/pages/tabs/network.html.tmpl
>>>> index 6ddabaa..7e2825d 100644
>>>> --- a/ui/pages/tabs/network.html.tmpl
>>>> +++ b/ui/pages/tabs/network.html.tmpl
>>>> @@ -85,11 +85,11 @@
>>>> </div>
>>>> <div id="modalWindow" class="modal fade network-modal"
>>>> tabindex="-1" role="dialog" aria-labelledby="networkModalLabel"
>>>> aria-hidden="true"> </div>
>>>> <script id="networkItem" type="text/html">
>>>> - <div id='{name}' class='wok-nw-grid-body
>>>> remove-when-logged-off '>
>>>> + <div id='{name}' class='wok-nw-grid-body remove-when-logged-off'>
>>>> <span class='column-state' val="{state}"><span
>>>> class='network-state {state}'><i class="fa fa-power-off"></i><span
>>>> class="wok-nw-loading-icon"></span></span></span><!--
>>>> --><span class='column-name' title="{name}"
>>>> val="{name}">{name}</span><!--
>>>> --><span class='column-type'
>>>> val="{type}">{type}</span><!--
>>>> - --><span class='column-interface'
>>>> val="{interface}">{interface}</span><!--
>>>> + --><span class='column-interface'
>>>> data-placement="top" data-toggle="tooltip" title="{interface}"
>>>> val="{interface}">{interface}</span><!--
>>>> --><span class='column-space'
>>>> val="{addrSpace}">{addrSpace}</span><!--
>>>> --><span class='column-action'
>>>> style="display:none">
>>>> <span class="pull-right">
>>>
>>
>
8 years, 7 months
[PATCH v2][Wok] UI: Remove notification array and make notifications persistent
by Rodrigo Trujillo
There is an issue in frontend that does not allow notification messages
to be showed more than once if the problem happens again.
When user clicks on message close ("X") button, the notification message
is only removed from backend, but not from the UI array.
This patch changes functions to not use the array anymore, instead, it
checks if the message is being displayed by its message string, then
shows if necessary.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/js/src/wok.main.js | 1 -
ui/js/src/wok.utils.js | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index 2146b3d..cf5b6a2 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -19,7 +19,6 @@
*/
wok.NOTIFICATION_INTERVAL = 5000
-wok.postedNotifications = []
wok.tabMode = {};
wok.config = undefined;
diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
index 1fb3c9b..1b585f1 100644
--- a/ui/js/src/wok.utils.js
+++ b/ui/js/src/wok.utils.js
@@ -209,12 +209,12 @@ wok.notificationsLoop = function notificationsLoop() {
function(notifications){
if(notifications && notifications.length > 0) {
$.each(notifications, function(i, notif) {
- if (wok.postedNotifications.indexOf(notif.message) == -1) {
+ // Check if notification is being displayed
+ if (($("#alert-container").contents().find("div:contains('" + notif.message + "')").length) == 0) {
wok.message.notify(notif, '#message-container-area');
- wok.postedNotifications.push(notif.message);
}
- })
- };
+ });
+ }
setTimeout(notificationsLoop, wok.NOTIFICATION_INTERVAL);
},
function(data){
--
2.1.0
8 years, 7 months
[PATCH V2][Wok] Issue #115: _get_resources wok_log.error result into unicode error.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
As ident is in encoded value but e.message is in unicode value,
combination of which result into unicode value having encoded ident value.
So when wok_log.error try to encode(encoded value) it result into error.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index be5f618..4b459ed 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -35,7 +35,7 @@ from wok.exception import MissingParameter, NotFoundError
from wok.exception import OperationFailed, UnauthorizedError, WokException
from wok.message import WokMessage
from wok.reqlogger import RequestRecord
-from wok.utils import get_plugin_from_request, utf8_dict, wok_log
+from wok.utils import get_plugin_from_request, utf8_dict, wok_log, encode_value
# Default request log messages
@@ -374,8 +374,14 @@ class Collection(object):
except Exception as e:
# In case of errors when fetching a resource info, pass and
# log the error, so, other resources are returned
+ # log the error, so, other resources are returned.
+ # Encoding error message as ident is also encoded value.
+ # This has to be done to avoid unicode error,
+ # as combination of encoded and unicode value results into
+ # unicode error.
wok_log.error("Problem in lookup of resource '%s'. "
- "Detail: %s" % (ident, e.message))
+ "Detail: %s" % (ident,
+ encode_value(e.message)))
continue
res_list.append(res)
return res_list
--
2.5.0
8 years, 7 months
[PATCH V2][Wok 00/12] FVT testcases wok framework
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Patch for adding FVT testcases wok framework which can be used across plugins.
The changes are:
1) Added fvt package inside tests directory.
2) Added config file inside fvt package to have session details.
3) restapilib.py to have common classes/methods for REST API calls.
4) fvt_base.py, a base test class to take care of doing
common setup and treadown required for any fvt test cases like
creating/destroying session using config file and restapilib.py.
5) run_test.sh.in script to install all the dependencies and to run all FVT.
6) make file changes to have 'make check-fvt' for running all the FVT.
7) Instruction added in REDME.md for make check-fvt.
8) Added tests/fvt/config into IBM license blacklist.
Archana Singh (12):
FVT: Package for functional verification testcases.
FVT: Wok level config file to have 'sectionsi required for fvt common
across plugins.
FVT: Lists all dependecies for fvt testcases.
FVT: Common classes/methods for API calls as per config file
configuration.
FVT: Base test class, takes care common actions required for any FVT
test cases.
FVT: Install all the dependencies from requirements.txt and runs FVT
testcases
FVT: Makefile needed for build and run fvt.
FVT: Added fvt as subdirs and check-fvt to run fvt testcases using
make.
FVT: Added FVT Makefile path in AC_CONFIG_FILES list.
FVT: Added check-fvt to run FVT testcases using make and venv dir to
be cleaned.
FVT: Added Readme instruction for running fvt testcases.
Added tests/fvt/config file into backlist.
IBM-license-blacklist | 1 +
Makefile.am | 6 +
configure.ac | 1 +
docs/README.md | 8 +
tests/Makefile.am | 7 +
tests/fvt/Makefile.am | 43 +++
tests/fvt/__init__.py | 18 ++
tests/fvt/config | 7 +
tests/fvt/fvt_base.py | 92 ++++++
tests/fvt/requirements.txt | 23 ++
tests/fvt/restapilib.py | 738 +++++++++++++++++++++++++++++++++++++++++++++
tests/fvt/run_tests.sh.in | 92 ++++++
12 files changed, 1036 insertions(+)
create mode 100644 tests/fvt/Makefile.am
create mode 100644 tests/fvt/__init__.py
create mode 100644 tests/fvt/config
create mode 100644 tests/fvt/fvt_base.py
create mode 100644 tests/fvt/requirements.txt
create mode 100644 tests/fvt/restapilib.py
create mode 100755 tests/fvt/run_tests.sh.in
--
2.5.0
8 years, 7 months
[PATCH V2][Wok] Added extended locale list.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
ui/pages/login.html.tmpl | 194 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 172 insertions(+), 22 deletions(-)
diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
index 52b81fd..0357d64 100644
--- a/ui/pages/login.html.tmpl
+++ b/ui/pages/login.html.tmpl
@@ -138,28 +138,178 @@
<div class="form-group">
<label for="userLocale">$_("Locale")</label>
<select id="userLocale" class="selectpicker col-md-12 col-lg-12">
- <option value="af-NA">Afrikaans (Namibia)</option>
- <option value="ar-DZ">Arabic (Algeria)</option>
- <option value="az-AZ">Azerbaijani (Azerbaijan)</option>
- <option value="en-US">English (US)</option>
- <option value="hy-AM">Armenian (Armenia)</option>
- <option value="hi-IN">Hindi (India)</option>
- <option value="nl-BE">Dutch (Belgium)</option>
- <option value="ms-MY">Malay (Malaysia)</option>
- <option value="no-NO">Norwegian (Norway)</option>
- <option value="sq-AL">Albanian (Albania)</option>
- <option value="sv-SE">Swedish (Sweden)</option>
- <option value="uz-UZ">Uzbek (Uzbekistan)</option>
- <option value="zh-CN">中文(简体)</option>
- <option value="pt-BR">Português (Brasil)</option>
- <option value="de-DE">Deutsch (Deutschland)</option>
- <option value="es-ES">Español (España)</option>
- <option value="fr-FR">Français (France)</option>
- <option value="it-IT">Italiano (Italia)</option>
- <option value="ja-JP">日本語 (日本)</option>
- <option value="ko-KR">한국어 (대한민국)</option>
- <option value="ru-RU">Русский (Россия)</option>
- <option value="zh-TW">中文(繁體)</option>
+ <option value="af-ZA">Afrikaans (South Africa)</option>
+ <option value="sq-AL">Albanian (Albania)</option>
+ <option value="am-ET">Amharic (Ethiopia)</option>
+ <option value="ar-DZ">Arabic (Algeria)</option>
+ <option value="ar-BH">Arabic (Bahrain)</option>
+ <option value="ar-EG">Arabic (Egypt)</option>
+ <option value="ar-IQ">Arabic (Iraq)</option>
+ <option value="ar-JO">Arabic (Jordan)</option>
+ <option value="ar-KW">Arabic (Kuwait)</option>
+ <option value="ar-LB">Arabic (Lebanon)</option>
+ <option value="ar-LY">Arabic (Libya)</option>
+ <option value="ar-MR">Arabic (Mauritania)</option>
+ <option value="ar-MA">Arabic (Morocco)</option>
+ <option value="ar-OM">Arabic (Oman)</option>
+ <option value="ar-QA">Arabic (Qatar)</option>
+ <option value="ar-SA">Arabic (Saudi Arabia)</option>
+ <option value="ar-SY">Arabic (Syria)</option>
+ <option value="ar-TN">Arabic (Tunisia)</option>
+ <option value="ar-AE">Arabic (United Arab Emirates)</option>
+ <option value="ar-YE">Arabic (Yemen)</option>
+ <option value="hy-AM">Armenian (Armenia)</option>
+ <option value="as-IN">Assamese (India)</option>
+ <option value="az-AZ">Azerbaijani (Azerbaijan)</option>
+ <option value="eu-ES">Basque (Spain)</option>
+ <option value="be-BY">Belarusian (Belarus)</option>
+ <option value="bn-BD">Bengali (Bangladesh)</option>
+ <option value="bn-IN">Bengali (India)</option>
+ <option value="bs-BA">Bosnian (Bosnia)</option>
+ <option value="bg-BG">Bulgarian (Bulgaria)</option>
+ <option value="my-MM">Burmese (Myanmar)</option>
+ <option value="ca-ES">Catalan (Spain)</option>
+ <option value="zh-CN">Chinese-simplified (China)</option>
+ <option value="zh-SG">Chinese-simplified (Singapore)</option>
+ <option value="zh-HK">Chinese-traditional (Hong Kong S.A.R. of China)</option>
+ <option value="zh-MO">Chinese-traditional (Macao)</option>
+ <option value="zh-TW">Chinese-traditional (Taiwan)</option>
+ <option value="hr-HR">Croatian (Croatia)</option>
+ <option value="cs-CZ">Czech (Czech Republic)</option>
+ <option value="da-DK">Danish (Denmark)</option>
+ <option value="nl-BE">Dutch (Belgium)</option>
+ <option value="nl-NL">Dutch (The Netherlands)</option>
+ <option value="en-AU">English (Australia)</option>
+ <option value="en-BE">English (Belgium)</option>
+ <option value="en-CM">English (Cameroon)</option>
+ <option value="en-CA">English (Canada)</option>
+ <option value="en-GH">English (Ghana)</option>
+ <option value="en-HK">English (Hong Kong S.A.R. of China)</option>
+ <option value="en-IN">English (India)</option>
+ <option value="en-IE">English (Ireland)</option>
+ <option value="en-KE">English (Kenya)</option>
+ <option value="en-MU">English (Mauritius)</option>
+ <option value="en-NZ">English (New Zealand)</option>
+ <option value="en-NG">English (Nigeria)</option>
+ <option value="en-PH">English (Philippines)</option>
+ <option value="en-SG">English (Singapore)</option>
+ <option value="en-ZA">English (South Africa)</option>
+ <option value="en-TZ">English (Tanzania)</option>
+ <option value="en-GB">English (United Kingdom)</option>
+ <option value="en-US">English (United States)</option>
+ <option value="en-ZM">English (Zambia)</option>
+ <option value="et-EE">Estonian (Estonia)</option>
+ <option value="tl-PH">Filipino (Philippines)</option>
+ <option value="fi-FI">Finnish (Finland)</option>
+ <option value="fr-DZ">French (Algeria)</option>
+ <option value="fr-CM">French (Cameroon)</option>
+ <option value="fr-CD">French (Democratic Republic of the Congo)</option>
+ <option value="fr-BE">French (Belgium)</option>
+ <option value="fr-CA">French (Canada)</option>
+ <option value="fr-FR">French (France)</option>
+ <option value="fr-CI">French (Ivory Coast [Côte d’Ivoire])</option>
+ <option value="fr-LU">French (Luxembourg)</option>
+ <option value="fr-MR">French (Mauritania)</option>
+ <option value="fr-MU">French (Mauritius)</option>
+ <option value="fr-MA">French (Morocco)</option>
+ <option value="fr-SN">French (Senegal)</option>
+ <option value="fr-CH">French (Switzerland)</option>
+ <option value="fr-TN">French (Tunisia)</option>
+ <option value="gl-ES">Galician (Spain)</option>
+ <option value="lg-UG">Ganda (Uganda)</option>
+ <option value="ka-GE">Georgian (Georgia)</option>
+ <option value="de-AT">German (Austria)</option>
+ <option value="de-DE">German (Germany)</option>
+ <option value="de-LU">German (Luxembourg)</option>
+ <option value="de-CH">German (Switzerland)</option>
+ <option value="el-GR">Greek (Greece)</option>
+ <option value="gu-IN">Gujarati (India)</option>
+ <option value="ha-NG">Hausa (Nigeria)</option>
+ <option value="he-IL">Hebrew (Israel)</option>
+ <option value="hi-IN">Hindi (India)</option>
+ <option value="hu-HU">Hungarian (Hungary)</option>
+ <option value="is-IS">Icelandic (Iceland)</option>
+ <option value="ig-NG">Igbo (Nigeria)</option>
+ <option value="id-ID">Indonesian (Indonesia)</option>
+ <option value="it-IT">Italian (Italy)</option>
+ <option value="it-CH">Italian (Switzerland)</option>
+ <option value="ja-JP">Japanese (Japan)</option>
+ <option value="kn-IN">Kannada (India)</option>
+ <option value="kk-KZ">Kazakh (Kazakhstan)</option>
+ <option value="km-KH">Khmer (Cambodia)</option>
+ <option value="rw-RW">Kinyarwanda (Rwanda)</option>
+ <option value="kok-IN">Konkani (India)</option>
+ <option value="ko-KR">Korean (Korea, South)</option>
+ <option value="lo-LA">Lao (Laos)</option>
+ <option value="lv-LV">Latvian (Latvia)</option>
+ <option value="lt-LT">Lithuanian (Lithuania)</option>
+ <option value="mk-MK">Macedonian (Macedonia)</option>
+ <option value="ms-MY">Malay-Latin (Malaysia)</option>
+ <option value="ml-IN">Malayalam (India)</option>
+ <option value="mt-MT">Maltese (Malta)</option>
+ <option value="mr-IN">Marathi (India)</option>
+ <option value="mn-Cyrl-MN">Mongolian-Cyrillic (Mongolia)</option>
+ <option value="ne-IN">Nepali (India)</option>
+ <option value="ne-NP">Nepali (Nepal)</option>
+ <option value="nb-NO">Norwegian Bokmål (Norway)</option>
+ <option value="nn-NO">Norwegian Nynorsk (Norway)</option>
+ <option value="or-IN">Oriya [aka, Odia] (India)</option>
+ <option value="om-ET">Oromo (Ethiopia)</option>
+ <option value="pl-PL">Polish (Poland)</option>
+ <option value="pt-AO">Portuguese (Angola)</option>
+ <option value="pt-BR">Portuguese (Brazil)</option>
+ <option value="pt-MO">Portuguese (Macao)</option>
+ <option value="pt-MZ">Portuguese (Mozambique)</option>
+ <option value="pt-PT">Portuguese (Portugal)</option>
+ <option value="pa-IN">Punjabi (India)</option>
+ <option value="ro-RO">Romanian (Romania)</option>
+ <option value="ru-RU">Russian (Russia)</option>
+ <option value="sr-RS">Serbian-Cyrillic (Serbia)</option>
+ <option value="sr-ME">Serbian-Latin (Montenegro)</option>
+ <option value="sr-Latn-RS">Serbian-Latin (Serbia)</option>
+ <option value="si-LK">Sinhala (Sri Lanka)</option>
+ <option value="sk-SK">Slovak (Slovakia)</option>
+ <option value="sl-SI">Slovenian (Slovenia)</option>
+ <option value="es-AR">Spanish (Argentina)</option>
+ <option value="es-BO">Spanish (Bolivia)</option>
+ <option value="es-CL">Spanish (Chile)</option>
+ <option value="es-CO">Spanish (Colombia)</option>
+ <option value="es-CR">Spanish (Costa Rica)</option>
+ <option value="es-DO">Spanish (Dominican Republic)</option>
+ <option value="es-EC">Spanish (Ecuador)</option>
+ <option value="es-SV">Spanish (El Salvador)</option>
+ <option value="es-GT">Spanish (Guatemala)</option>
+ <option value="es-HN">Spanish (Honduras)</option>
+ <option value="es-MX">Spanish (Mexico)</option>
+ <option value="es-NI">Spanish (Nicaragua)</option>
+ <option value="es-PA">Spanish (Panama)</option>
+ <option value="es-PY">Spanish (Paraguay)</option>
+ <option value="es-PE">Spanish (Peru)</option>
+ <option value="es-PR">Spanish (Puerto Rico)</option>
+ <option value="es-ES">Spanish (Spain)</option>
+ <option value="es-US">Spanish (United States)</option>
+ <option value="es-UY">Spanish (Uruguay)</option>
+ <option value="es-VE">Spanish (Venezuela)</option>
+ <option value="sw-KE">Swahili (Kenya)</option>
+ <option value="sw-TZ">Swahili (Tanzania)</option>
+ <option value="sv-SE">Swedish (Sweden)</option>
+ <option value="ta-IN">Tamil (India)</option>
+ <option value="te-IN">Telugu (India)</option>
+ <option value="th-TH">Thai (Thailand)</option>
+ <option value="tr-TR">Turkish (Turkey)</option>
+ <option value="uk-UA">Ukrainian (Ukraine)</option>
+ <option value="ur-IN">Urdu (India)</option>
+ <option value="ur-PK">Urdu (Pakistan)</option>
+ <option value="uz-Cyrl-UZ">Uzbek-Cyrillic (Uzbekistan)</option>
+ <option value="uz-Latn-UZ">Uzbek-Latin (Uzbekistan)</option>
+ <option value="vi-VN">Vietnamese (Vietnam)</option>
+ <option value="cy-GB">Welsh (United Kingdom)</option>
+ <option value="yo-NG">Yoruba (Nigeria)</option>
+ <option value="zu-ZA">Zulu (South Africa)</option>
+ <option value="az-AZ">Azerbaijani-Latin (Azerbaijan)</option>
+ <option value="sr-CS">Serbian-Cyrillic ()</option>
+ <option value="sr-Cyrl-CS">Serbian-Cyrillic (Serbia and Montenegro)</option>
+ <option value="sr-Latn-CS">Serbian-Latin (Serbia and Montenegro)</option>
</select>
</div>
</form>
--
2.5.0
8 years, 7 months