On Fri, Apr 8, 2016 at 3:50 AM, Petr Vobornik <pvobo...@redhat.com> wrote:
> I didn't examine it thoroughly. But basically: IPA management framework
> does "cn" -> "dn" conversion in pre_callback (host-add, host-mod). But
> then it needs to do the reverse on post_callback (host-add, host-mod,
> host-show, maybe also host-find)
> Given that manager field was your example, you can also look at
> "convert_manager" method which does the "dn" -> "cn" conversion. And how
> it is called in post_callback/how are post_callbacks defined.

I figured that was the next step; I did note that if I manually
entered the right data, either via ldapmodify or host-mod with a full
dn, it worked fine but then displayed the entire dn in the UI, so I
assumed there was another bit to make that conversion and just hadn't
looked ahead for it.

> Apart from that, I don't see what is wrong. How does it behave?

The file as it is now is here:
http://www.astro.princeton.edu/~huston/astrocustom/astrocustom.1144.py.html
(take off the .html for the source file if you prefer).

And the error when I run 'ipa host-mod syrinx.astro.princeton.edu
--owner=huston' is:

[Fri Apr 08 11:32:29.096491 2016] [:error] [pid 5833] ipa: ERROR:
non-public: AttributeError: 'module' object has no attribute 'backend'
[Fri Apr 08 11:32:29.096522 2016] [:error] [pid 5833] Traceback (most
recent call last):
[Fri Apr 08 11:32:29.096524 2016] [:error] [pid 5833]   File
"/usr/lib/python2.7/site-packages/ipaserver/rpcserver.py", line 347,
in wsgi_execute
[Fri Apr 08 11:32:29.096526 2016] [:error] [pid 5833]     result =
self.Command[name](*args, **options)
[Fri Apr 08 11:32:29.096527 2016] [:error] [pid 5833]   File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 442, in
__call__
[Fri Apr 08 11:32:29.096529 2016] [:error] [pid 5833]     ret =
self.run(*args, **options)
[Fri Apr 08 11:32:29.096530 2016] [:error] [pid 5833]   File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 759, in
run
[Fri Apr 08 11:32:29.096532 2016] [:error] [pid 5833]     return
self.execute(*args, **options)
[Fri Apr 08 11:32:29.096533 2016] [:error] [pid 5833]   File
"/usr/lib/python2.7/site-packages/ipalib/plugins/baseldap.py", line
1468, in execute
[Fri Apr 08 11:32:29.096535 2016] [:error] [pid 5833]     *keys, **options)
[Fri Apr 08 11:32:29.096536 2016] [:error] [pid 5833]   File
"/usr/lib/python2.7/site-packages/ipalib/plugins/astrocustom.py", line
80, in hostmod_precallback
[Fri Apr 08 11:32:29.096538 2016] [:error] [pid 5833]
entry_attrs['owner'] = self.obj.normalize_owner(entry_attrs['owner'],
self.obj.container_dn)
[Fri Apr 08 11:32:29.096539 2016] [:error] [pid 5833]   File
"/usr/lib/python2.7/site-packages/ipalib/plugins/astrocustom.py", line
35, in normalize_owner
[Fri Apr 08 11:32:29.096541 2016] [:error] [pid 5833]     entry_attrs
= self.backend.find_entry_by_attr(
[Fri Apr 08 11:32:29.096542 2016] [:error] [pid 5833] AttributeError:
'module' object has no attribute 'backend'
[Fri Apr 08 11:32:29.096861 2016] [:error] [pid 5833] ipa: INFO:
[jsonserver_session] ad...@astro.princeton.edu:
host_mod(u'syrinx.astro.princeton.edu', random=False, owner=u'huston',
rights=False, updatedns=False, all=False, raw=False, version=u'2.156',
no_members=False): AttributeError

To test the new parts, I then did an ldapmodify to set the owner
attribute, and 'ipa host-show syrinx --all' gave this error:

[Fri Apr 08 11:41:38.050569 2016] [:error] [pid 5832] ipa: ERROR:
non-public: AttributeError: 'module' object has no attribute
'get_primary_key_from_dn'
[Fri Apr 08 11:41:38.050588 2016] [:error] [pid 5832] Traceback (most
recent call last):
[Fri Apr 08 11:41:38.050591 2016] [:error] [pid 5832]   File
"/usr/lib/python2.7/site-packages/ipaserver/rpcserver.py", line 347,
in wsgi_execute
[Fri Apr 08 11:41:38.050593 2016] [:error] [pid 5832]     result =
self.Command[name](*args, **options)
[Fri Apr 08 11:41:38.050594 2016] [:error] [pid 5832]   File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 442, in
__call__
[Fri Apr 08 11:41:38.050596 2016] [:error] [pid 5832]     ret =
self.run(*args, **options)
[Fri Apr 08 11:41:38.050597 2016] [:error] [pid 5832]   File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 759, in
run
[Fri Apr 08 11:41:38.050599 2016] [:error] [pid 5832]     return
self.execute(*args, **options)
[Fri Apr 08 11:41:38.050601 2016] [:error] [pid 5832]   File
"/usr/lib/python2.7/site-packages/ipalib/plugins/baseldap.py", line
1380, in execute
[Fri Apr 08 11:41:38.050602 2016] [:error] [pid 5832]     self, ldap,
entry_attrs.dn, entry_attrs, *keys, **options)
[Fri Apr 08 11:41:38.050604 2016] [:error] [pid 5832]   File
"/usr/lib/python2.7/site-packages/ipalib/plugins/astrocustom.py", line
98, in hostshow_postcallback
[Fri Apr 08 11:41:38.050605 2016] [:error] [pid 5832]
self.obj.convert_owner(entry_attrs, **options)
[Fri Apr 08 11:41:38.050607 2016] [:error] [pid 5832]   File
"/usr/lib/python2.7/site-packages/ipalib/plugins/astrocustom.py", line
55, in convert_owner
[Fri Apr 08 11:41:38.050608 2016] [:error] [pid 5832]
entry_attrs['owner'][m] =
self.get_primary_key_from_dn(entry_attrs['owner'][m])
[Fri Apr 08 11:41:38.050610 2016] [:error] [pid 5832] AttributeError:
'module' object has no attribute 'get_primary_key_from_dn'
[Fri Apr 08 11:41:38.050757 2016] [:error] [pid 5832] ipa: INFO:
[jsonserver_session] ad...@astro.princeton.edu: host_show(u'syrinx',
rights=False, all=True, raw=False, version=u'2.156',
no_members=False): AttributeError



-- 
Steve Huston - W2SRH - Unix Sysadmin, PICSciE/CSES & Astrophysical Sci
  Princeton University  |    ICBM Address: 40.346344   -74.652242
    345 Lewis Library   |"On my ship, the Rocinante, wheeling through
  Princeton, NJ   08544 | the galaxies; headed for the heart of Cygnus,
    (267) 793-0852      | headlong into mystery."  -Rush, 'Cygnus X-1'

-- 
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project

Reply via email to