RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1428472 - batch param compatibility is incorrect
Summary: batch param compatibility is incorrect
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa
Version: 7.3
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: rc
: ---
Assignee: IPA Maintainers
QA Contact: Nikhil Dehadrai
URL:
Whiteboard:
Depends On:
Blocks: 1430674
TreeView+ depends on / blocked
 
Reported: 2017-03-02 16:15 UTC by Petr Vobornik
Modified: 2017-08-01 09:44 UTC (History)
8 users (show)

Fixed In Version: ipa-4.4.0-14.el7.7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1430674 (view as bug list)
Environment:
Last Closed: 2017-08-01 09:44:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2304 0 normal SHIPPED_LIVE ipa bug fix and enhancement update 2017-08-01 12:41:35 UTC

Description Petr Vobornik 2017-03-02 16:15:02 UTC
The definition of the batch params all define methods as Str. It has never been a Str. It was defined as Any until recently when it was refined to Dict.

This causes the batch command in ipalib on 4.4 to fail to work because methods is not a Str (it doesn't even get far enough to make a request, it blows up validating the input).

Here is the output from the sample program:
Traceback (most recent call last):
  File "batch.py", line 10, in <module>
    res = api.Command.batch(batch)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 449, in __call__
    return self.__do_call(*args, **options)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 470, in __do_call
    params = self.convert(**params)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 671, in convert
    (k, self.params[k].convert(v)) for (k, v) in kw.items()
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 671, in <genexpr>
    (k, self.params[k].convert(v)) for (k, v) in kw.items()
  File "/usr/lib/python2.7/site-packages/ipalib/parameters.py", line 831, in convert
    convert(v) for v in value if not _is_null(v)
  File "/usr/lib/python2.7/site-packages/ipalib/parameters.py", line 831, in <genexpr>
    convert(v) for v in value if not _is_null(v)
  File "/usr/lib/python2.7/site-packages/ipalib/parameters.py", line 1445, in _convert_scalar
    raise ConversionError(name=self.name, error=ugettext(self.type_error))
ipalib.errors.ConversionError: invalid 'methods': must be Unicode text



Reproducer (python script):

from ipalib import api
from ipalib import errors

api.bootstrap(context='cli')
api.finalize()
api.Backend.rpcclient.connect()

batch = [{u'params': [(u'test.example.com',), {u'force': u'True'}], u'method': u'host_add'}]

res = api.Command.batch(batch)


Expected result:

Commands are executed, command returns res and doesn't throw exception.

Comment 1 Petr Vobornik 2017-03-02 16:16:15 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/6647

Comment 2 Petr Vobornik 2017-03-02 16:17:10 UTC
master:
    19060db1b8fa9d1d3e8f3ac3fcd1f387e9a39c94 compat: fix Any params in batch and dnsrecord

Comment 6 Jan Cholasta 2017-03-14 05:27:38 UTC
Fixed upstream
ipa-4-4:
https://pagure.io/freeipa/c/e3b49abfe7a8d9540d77ed355595d9e44a3bdd27

Comment 8 Nikhil Dehadrai 2017-05-09 11:16:38 UTC
IPA server version:  ipa-server-4.5.0-10.el7.x86_64

Verified the bug on the basis of following steps performed on IPA-server setup on pre4.4 (In my case RHEL 7.2.z) version and IPA-client on latest version (RHEL 7.4):

IPA MASTER:
============
[root@intel-sugarbay-do-01 ~]# rpm -qa ipa-server
ipa-server-4.2.0-15.el7_2.19.x86_64
[root@intel-sugarbay-do-01 ~]# ## THIS is IPA-SERVER
[root@intel-sugarbay-do-01 ~]# ipactl status
Directory Service: RUNNING
krb5kdc Service: RUNNING
kadmin Service: RUNNING
named Service: RUNNING
ipa_memcached Service: RUNNING
httpd Service: RUNNING
pki-tomcatd Service: RUNNING
ipa-otpd Service: RUNNING
ipa-dnskeysyncd Service: RUNNING
ipa: INFO: The ipactl command was successful
[root@intel-sugarbay-do-01 ~]# ipa host-find test.example.com
ipa: ERROR: did not receive Kerberos credentials
[root@intel-sugarbay-do-01 ~]# kinit admin
Password for admin: 
[root@intel-sugarbay-do-01 ~]# ipa host-find test.example.com
---------------
0 hosts matched
---------------
----------------------------
Number of entries returned 0
----------------------------



IPA-CLIENT:
=============
[root@cloud-qe-15 ~]# rpm -q ipa-client
ipa-client-4.5.0-10.el7.x86_64
[root@cloud-qe-15 ~]# kinit admin
Password for admin: 
[root@cloud-qe-15 ~]# ipa host-find test.example.com
---------------
0 hosts matched
---------------
----------------------------
Number of entries returned 0
----------------------------
[root@cloud-qe-15 ~]# cat test.py 
from ipalib import api
from ipalib import errors

api.bootstrap(context='cli')
api.finalize()
api.Backend.rpcclient.connect()

batch = [{u'params': [(u'test.example.com',), {u'force': u'True'}], u'method': u'host_add'}]

res = api.Command.batch(batch)
[root@cloud-qe-15 ~]# python test.py 
[root@cloud-qe-15 ~]# ipa host-find test.example.com
--------------
1 host matched
--------------
  Host name: test.example.com
  Principal name: host/test.example.com
  Password: False
  Keytab: False
  Managed by: test.example.com
----------------------------
Number of entries returned 1
----------------------------

IPA MASTER:
============
Now re-run "ipa host-find" on master:

[root@intel-sugarbay-do-01 ~]# ipa host-find test.example.com
--------------
1 host matched
--------------
  Host name: test.example.com
  Principal name: host/test.example.com
  Password: False
  Keytab: False
  Managed by: test.example.com
----------------------------
Number of entries returned 1
----------------------------

Thus on the basis of above steps, marking the status of bug to "VERIFIED"

Comment 9 errata-xmlrpc 2017-08-01 09:44:33 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://access.redhat.com/errata/RHBA-2017:2304


Note You need to log in before you can comment on or make changes to this bug.