On Fri, 27 Mar 2009 18:10:24 +0100, "Vreman, Peter - Acision"
<peter.vreman(a)acision.com> wrote:
Maybe the it comes from the change to json, but the find for distro
and
repo is not working:
2009-03-27 17:37:44,375 - api - find_distro; user(?)
2009-03-27 17:37:44,375 - api - {'name': 'RHEL'}; user(?)
2009-03-27 17:37:44,375 - api - Exception occured: cobbler.cexceptions.CX
2009-03-27 17:37:44,375 - api - Exception value: "find cannot compare
type:
<type 'unicode'>"
2009-03-27 17:37:44,376 - api - Exception Info:
File "/usr/lib/python2.3/site-packages/cobbler/remote.py", line 1604,
in
_dispatch
return method_handle(*params)
File "/usr/lib/python2.3/site-packages/cobbler/remote.py", line 604,
in
find_distro
data =
self.__find(self.api.find_distro,criteria,expand=expand,token=token)
File "/usr/lib/python2.3/site-packages/cobbler/remote.py", line 597,
in
__find
data = [x.to_datastruct_with_cache() for x in find_function(name,
True,
True, **criteria)]
File "/usr/lib/python2.3/site-packages/cobbler/api.py", line 432, in
find_distro
return self._config.distros().find(name=name,
return_list=return_list,
no_errors=no_errors, **kargs)
File "/usr/lib/python2.3/site-packages/cobbler/collection.py", line
91,
in find
if obj.find_match(kargs, no_errors=no_errors):
File "/usr/lib/python2.3/site-packages/cobbler/item.py", line 268, in
find_match
if not self.find_match_single_key(data,key,value,no_errors):
File "/usr/lib/python2.3/site-packages/cobbler/item.py", line 295, in
find_match_single_key
return self.__find_compare(value, data[key])
File "/usr/lib/python2.3/site-packages/cobbler/item.py", line 336, in
__find_compare
raise CX(_("find cannot compare type: %s") % type(from_obj))
The following patch fixes this for me:
--- old/cobbler/item.py 2009-03-27 14:51:25.000000000 +0100
+++ build/cobbler/item.py 2009-03-27 17:54:16.000000000 +0100
@@ -297,7 +297,7 @@
def __find_compare(self, from_search, from_obj):
- if type(from_obj) == type(""):
+ if type(from_obj) == type("") or type(from_obj) == unicode:
# FIXME: fnmatch is only used for string to string
comparisions
# which should cover most major usage, if not, this deserves
fixing
if fnmatch.fnmatch(from_obj.lower(), from_search.lower()):
Funny, we were just talking about this in IRC...
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.