From: Lucio <luciojhc(a)linux.vnet.ibm.com>
---
plugins/kimchi/utils.py | 40 ++++++++++++++++++++++++++++++++++++++++
src/wok/utils.py | 16 ----------------
2 files changed, 40 insertions(+), 16 deletions(-)
create mode 100644 plugins/kimchi/utils.py
diff --git a/plugins/kimchi/utils.py b/plugins/kimchi/utils.py
new file mode 100644
index 0000000..dc00481
--- /dev/null
+++ b/plugins/kimchi/utils.py
@@ -0,0 +1,40 @@
+#
+# 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 re
+
+from wok.exception import InvalidParameter
+
+
+def _uri_to_name(collection, uri):
+ expr = '/plugins/kimchi/%s/(.*?)$' % collection
+ m = re.match(expr, uri)
+ if not m:
+ raise InvalidParameter("KCHUTILS0001E", {'uri': uri})
+ return m.group(1)
+
+
+def template_name_from_uri(uri):
+ return _uri_to_name('templates', uri)
+
+
+def pool_name_from_uri(uri):
+ return _uri_to_name('storagepools', uri)
+
diff --git a/src/wok/utils.py b/src/wok/utils.py
index 31a06bc..6011238 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -44,22 +44,6 @@ wok_log = cherrypy.log.error_log
task_id = 0
-def _uri_to_name(collection, uri):
- expr = '/%s/(.*?)$' % collection
- m = re.match(expr, uri)
- if not m:
- raise InvalidParameter("KCHUTILS0001E", {'uri': uri})
- return m.group(1)
-
-
-def template_name_from_uri(uri):
- return _uri_to_name('templates', uri)
-
-
-def pool_name_from_uri(uri):
- return _uri_to_name('storagepools', uri)
-
-
def get_next_task_id():
global task_id
task_id += 1
--
1.7.1