Vreman, Peter - Acision 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()):
>
>
>
>
>
> Regards,
>
> Peter
>
>
>
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be
> copied, disclosed to, retained or used by, any other party. If you are
> not an intended recipient then please promptly delete this e-mail and
> any attachment and all copies and inform the sender. Thank you.
> ------------------------------------------------------------------------
>
> _______________________________________________
> cobbler-devel mailing list
> cobbler-devel(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/cobbler-devel
>
>
Thanks for the fix Peter,
We're going to go with Scott's patch just because it seems a bit cleaner.
Much appreciated just the same!
--Michael
_______________________________________________
cobbler-devel mailing list
cobbler-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler-devel
Actually I'm seeing "name must be a string" after having applied Scott's
patch.
We may use the above... I'll figure it out.
--Michael