Red Hat Bugzilla – Bug 1428472
batch param compatibility is incorrect
Last modified: 2017-08-01 05:44:33 EDT
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.
Upstream ticket: https://pagure.io/freeipa/issue/6647
master: 19060db1b8fa9d1d3e8f3ac3fcd1f387e9a39c94 compat: fix Any params in batch and dnsrecord
Fixed upstream ipa-4-4: https://pagure.io/freeipa/c/e3b49abfe7a8d9540d77ed355595d9e44a3bdd27
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@TESTRELM.TEST: [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@TESTRELM.TEST: [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@TESTRELM.TEST 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@TESTRELM.TEST 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"
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