James Cammarata wrote:
On Sun, 26 Apr 2009 17:08:44 -0500, James Cammarata
<jimi(a)sngx.net> wrote:
> So this is a new issue. Got to images, and I'm seeing this traceback in
> cobblerd.log:
>
> 2009-04-26 17:07:33,355 - api - REMOTE calling authorize for resource
> ['modify_image', 'testing', None]; user(cobbler)
> 2009-04-26 17:07:33,356 - api - Exception occured:
> exceptions.AttributeError
> 2009-04-26 17:07:33,356 - api - Exception value: 'str' object has no
> attribute 'owners'
> 2009-04-26 17:07:33,357 - api - Exception Info:
> File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1102,
>
in
> check_access_no_fail
> self.check_access(token,resource,arg1,arg2)
> File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1115,
>
in
> check_access
> rc = self.__authorize(token,resource,arg1,arg2)
> File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1142,
>
in
> __authorize
> rc = self.api.authorize(user,resource,arg1,arg2)
> File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 729, in
> authorize
> rc =
>
>
self.authz.authorize(self,user,resource,arg1,arg2,acl_engine=self.acl_engine)
> File
> "/usr/lib/python2.4/site-packages/cobbler/modules/authz_ownership.py",
>
line
> 179, in authorize
> if obj is None or obj.owners is None or obj.owners == []:
>
>
> That would seem to be a bug, anyone else using ownership with images?
>
So I think I found the issue here. In remote.py, starting at line 1111:
need_remap = False
for x in [ "distro", "profile", "system",
"repo" ]:
if arg1 is not None and resource.find(x) != -1:
need_remap = True
break
if need_remap:
# we're called with an object name, but need an object
arg1 = self.__name_to_object(resource,arg1)
So images are not hitting this code, when I believe they should be. As a
result, arg1 is a string, which when passed up the chain is expected to be
a class with the "owners" property.
Was there any reason images were excluded from this? If not, I'll submit a
patch.
Sorry, I thought you had already squared this one away so I had stopped
following this thread.
Reason? None. I suspect the number of people using authz_ownership is
pretty low (maybe 5% of the userbase? If anyone is using that, let us
know) and that the amount of people
using image objects is even lower -- since they mainly cover a virt use
case or if you wanted to send something like memtest out to a specific
system.
Patch would be great.
--Michael