Bug 1246342

Summary: Unapply idview raises internal error
Product: Red Hat Enterprise Linux 7 Reporter: Jan Cholasta <jcholast>
Component: ipaAssignee: IPA Maintainers <ipa-maint>
Status: CLOSED ERRATA QA Contact: Namita Soman <nsoman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: jcholast, ksiddiqu, rcritten, sumenon, tbabej
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-4.2.0-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 12:04:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Cholasta 2015-07-24 04:19:05 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/4969

Exception from test_xmlrpc/test_idviews_plugin.py tests:

{{{
[Tue Mar 31 06:05:48.112746 2015] [wsgi:error] [pid 28602] ipa: ERROR: non-public: AttributeError: 'NoneType' object has no attribute 'lower'
[Tue Mar 31 06:05:48.112780 2015] [wsgi:error] [pid 28602] Traceback (most recent call last):
[Tue Mar 31 06:05:48.112785 2015] [wsgi:error] [pid 28602]   File "/usr/lib/python2.7/site-packages/ipaserver/rpcserver.py", line 349, in wsgi_execute
[Tue Mar 31 06:05:48.112790 2015] [wsgi:error] [pid 28602]     result = self.Command[name](*args, **options)
[Tue Mar 31 06:05:48.112794 2015] [wsgi:error] [pid 28602]   File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 443, in __call__
[Tue Mar 31 06:05:48.112798 2015] [wsgi:error] [pid 28602]     ret = self.run(*args, **options)
[Tue Mar 31 06:05:48.112802 2015] [wsgi:error] [pid 28602]   File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 760, in run
[Tue Mar 31 06:05:48.112806 2015] [wsgi:error] [pid 28602]     return self.execute(*args, **options)
[Tue Mar 31 06:05:48.112810 2015] [wsgi:error] [pid 28602]   File "/usr/lib/python2.7/site-packages/ipalib/plugins/idviews.py", line 413, in execute
[Tue Mar 31 06:05:48.112814 2015] [wsgi:error] [pid 28602]     return super(idview_unapply, self).execute(*keys, **options)
[Tue Mar 31 06:05:48.112818 2015] [wsgi:error] [pid 28602]   File "/usr/lib/python2.7/site-packages/ipalib/plugins/idviews.py", line 246, in execute
[Tue Mar 31 06:05:48.112822 2015] [wsgi:error] [pid 28602]     if view.lower() == DEFAULT_TRUST_VIEW_NAME:
[Tue Mar 31 06:05:48.112826 2015] [wsgi:error] [pid 28602] AttributeError: 'NoneType' object has no attribute 'lower'
}}}

Comment 2 Kaleem 2015-08-07 13:42:06 UTC
How to verify this?

Comment 3 Tomas Babej 2015-08-07 14:56:25 UTC
1. Apply an ID view to a particular host or hostgroup
2. Un-apply the ID view
3. Check that command succeeds without raising the internal error mentioned

Comment 5 Sudhir Menon 2015-09-30 10:53:24 UTC
Verified using RHEL7.2

ipa-server-trust-ad-4.2.0-12.el7.x86_64
ipa-server-4.2.0-12.el7.x86_64
ipa-server-dns-4.2.0-12.el7.x86_64

Obseravtions: 

1. No error is seen on the IPA UI when IDview is applied/unapplied for a host/hostgroup.

2. Even from the command line utility no error is seen.

[root@ipa01 ~]# ipa idview-apply --hosts ipaclient02.labs01.test
ID View Name: testview
--------------------------
Applied ID View "testview"
--------------------------
  hosts: ipaclient02.labs01.test
---------------------------------------------
Number of hosts the ID View was applied to: 1
---------------------------------------------

[root@ipa01 ~]# ipa idview-unapply --hosts ipaclient02.labs01.test
----------------
Cleared ID Views
----------------
  hosts: ipaclient02.labs01.test
-----------------------------------------------
Number of hosts that had a ID View was unset: 1
-----------------------------------------------

[root@ipa01 ~]# ipa idview-apply --hostgroups=hostgroup1
ID View Name: testview
--------------------------
Applied ID View "testview"
--------------------------
  hosts: ipa01.labs01.test, ipaclient02.labs01.test
---------------------------------------------
Number of hosts the ID View was applied to: 2

---------------------------------------------
[root@ipa01 ~]# ipa idview-unapply --hostgroups=hostgroup1
----------------
Cleared ID Views
----------------
  hosts: ipa01.labs01.test, ipaclient02.labs01.test
-----------------------------------------------
Number of hosts that had a ID View was unset: 2
-----------------------------------------------

===httpd logs for the steps done on IPA UI===
[Wed Sep 30 16:18:31.860401 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: batch(({u'params': ((u'Default Trust View',), {}), u'method': u'idview_show'}, {u'params': ((u'testview',), {}), u'method': u'idview_show'}), version=u'2.156'): SUCCESS
[Wed Sep 30 16:18:45.726489 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idoverrideuser_find(u'testview', u'', sizelimit=0, version=u'2.156'): SUCCESS
[Wed Sep 30 16:18:46.583806 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:18:47.946661 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: host_find(u'', all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:18:50.862138 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_apply(u'testview', host=(u'ipaclient02.labs01.test',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:18:50.932388 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:19:07.016540 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: hostgroup_find(u'', all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:19:26.661037 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_unapply(host=(u'ipaclient02.labs01.test',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:19:26.731308 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:21:45.764963 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: hostgroup_show(u'hostgroup1', version=u'2.156'): SUCCESS
[Wed Sep 30 16:21:46.958277 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: host_find(u'', all=True, version=u'2.156', not_in_hostgroup=u'hostgroup1'): SUCCESS
[Wed Sep 30 16:21:50.405721 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: hostgroup_add_member(u'hostgroup1', all=True, version=u'2.156', host=(u'ipa01.labs01.test', u'ipaclient02.labs01.test')): SUCCESS
[Wed Sep 30 16:21:50.473210 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: hostgroup_show(u'hostgroup1', version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:00.167494 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: hostgroup_find(u'', all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:03.309363 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_apply(u'testview', hostgroup=(u'hostgroup1',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:09.476888 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:15.641233 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_unapply(host=(u'ipa01.labs01.test',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:15.724185 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:20.384033 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_unapply(host=(u'ipaclient02.labs01.test',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:20.489518 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:28.536975 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: user_find(None, version=u'2.156', no_members=True): SUCCESS
[Wed Sep 30 16:22:33.817231 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: hostgroup_find(u'', all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:36.891656 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_apply(u'testview', hostgroup=(u'hostgroup1',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:36.997726 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:42.100605 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: hostgroup_find(u'', all=True, version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:46.200134 2015] [:error] [pid 7054] ipa: INFO: [jsonserver_session] admin: idview_unapply(hostgroup=(u'hostgroup1',), version=u'2.156'): SUCCESS
[Wed Sep 30 16:22:46.288028 2015] [:error] [pid 7055] ipa: INFO: [jsonserver_session] admin: idview_show(u'testview', rights=True, show_hosts=True, all=True, version=u'2.156'): SUCCESS

Comment 6 errata-xmlrpc 2015-11-19 12:04:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2362.html