On 20.6.2016 19:56, Martin Basti wrote:



On 20.06.2016 18:48, Martin Basti wrote:


On 20.06.2016 16:42, Jan Cholasta wrote:
On 20.6.2016 16:13, David Kupka wrote:
On 28/04/16 14:45, Jan Cholasta wrote:
Hi,

I have pushed my thin client WIP branch to GitHub:
<https://github.com/jcholast/freeipa/tree/trac-4739>.

All commits up to "ipalib: use relative imports for cross-plugin
imports" should be good for review. The rest is subject to change
(WARNING: I will force push into this branch).

Honza


Hello!

Patches:
replica install: fix thin client regression
schema: remove `no_cli` from command schema
schema: remove redundant information
schema: merge command args and options
schema: remove output_params
schema: add object class schema
permission: handle ipapermright deprecated CLI alias on the client
passwd: handle sort order of passwd argument on the client
misc: skip `count` and `total` output in env.output_for_cli
dns: do not rely on custom param fields in record attributes
automember: add object plugin for automember_rebuild
frontend: do not crash on missing output in output_for_cli
frontend: skip `value` output in output_for_cli
frontend: don't copy command arguments to output params
makeaci, makeapi: use in-server API

work for me, ACK.

Pushed to master: 8cc8b6fb1023fa4aeafac0df01cfacff4ebf537a

Note that I haven't pushed "replica install: fix thin client
regression" yet, I would like Martin to review it first.

ACK

pushed to master:
* 91d6d87ca76e3aa27d5f87fd4f0b70f1d4fe4e72 replica install: fix thin
client regression


Attaching the patches for reference.


Note: There is one one known issue in automember output, will be fixed
later.





Guys, I suspect that one of previously pushed patches breaks following
command on the client side

# ipa dns-update-system-records
ipa: ERROR: KeyError: 'ipa_records'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1346, in run
    sys.exit(api.Backend.cli.run(argv))
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1111, in run
    rv = cmd.output_for_cli(self.api.Backend.textui, result, *args,
**options)
  File "/usr/lib/python2.7/site-packages/ipaclient/plugins/dns.py", line
367, in output_for_cli
    textui.print_indented(u'{}:'.format(labels[key]), indent=1)
KeyError: 'ipa_records'
ipa: ERROR: an internal error has occurred

Sorry. Fixed.

--
Jan Cholasta
From a1ae77ff2caf4daa87a0f1fdd4bc5e75bb8c3aae Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Tue, 21 Jun 2016 07:47:52 +0200
Subject: [PATCH] dns: fix dns_update_system_records to work with thin client

https://fedorahosted.org/freeipa/ticket/2008
https://fedorahosted.org/freeipa/ticket/4739
---
 API.txt                  |  6 ++++--
 VERSION                  |  4 ++--
 ipaclient/plugins/dns.py |  4 ++--
 ipaserver/plugins/dns.py | 20 ++++++++++++--------
 4 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/API.txt b/API.txt
index f2a0686..558be34 100644
--- a/API.txt
+++ b/API.txt
@@ -1068,10 +1068,12 @@ output: Output('result', type=[<type 'bool'>])
 output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
 output: Output('value', type=[<type 'unicode'>])
 command: dns_update_system_records
-args: 0,2,2
+args: 0,4,2
+option: Flag('all', autofill=True, cli_name='all', default=False)
 option: Flag('dry_run', autofill=True, default=False)
+option: Flag('raw', autofill=True, cli_name='raw', default=False)
 option: Str('version?')
-output: Output('result', type=[<type 'dict'>])
+output: Entry('result')
 output: Output('value', type=[<type 'bool'>])
 command: dnsconfig_mod
 args: 0,11,3
diff --git a/VERSION b/VERSION
index faf10e3..76b83ee 100644
--- a/VERSION
+++ b/VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
 #                                                      #
 ########################################################
 IPA_API_VERSION_MAJOR=2
-IPA_API_VERSION_MINOR=193
-# Last change: schema: remove `no_cli` from command schema
+IPA_API_VERSION_MINOR=194
+# Last change: dns: fix dns_update_system_records to work with thin client
diff --git a/ipaclient/plugins/dns.py b/ipaclient/plugins/dns.py
index d04f686..bca5ad7 100644
--- a/ipaclient/plugins/dns.py
+++ b/ipaclient/plugins/dns.py
@@ -23,7 +23,7 @@ from __future__ import print_function
 import six
 import copy
 
-from ipaclient.frontend import MethodOverride, CommandOverride
+from ipaclient.frontend import MethodOverride
 from ipalib import errors
 from ipalib.dns import (get_part_rrtype,
                         get_record_rrtype,
@@ -347,7 +347,7 @@ class dnsforwardzone_mod(MethodOverride):
 
 
 @register(override=True)
-class dns_update_system_records(CommandOverride):
+class dns_update_system_records(MethodOverride):
     def output_for_cli(self, textui, output, *args, **options):
         output_super = copy.deepcopy(output)
         super_res = output_super.get('result', {})
diff --git a/ipaserver/plugins/dns.py b/ipaserver/plugins/dns.py
index 14607b3..f350450 100644
--- a/ipaserver/plugins/dns.py
+++ b/ipaserver/plugins/dns.py
@@ -41,6 +41,7 @@ from ipalib.dns import (extra_name_format,
                         iterate_rrparams_by_parts,
                         part_name_format,
                         record_name_format)
+from ipalib.frontend import Method, Object
 from ipalib.request import context
 from ipalib import api, errors, output
 from ipalib import Command
@@ -4408,11 +4409,8 @@ class dnsforwardzone_remove_permission(DNSZoneBase_remove_permission):
 
 
 @register()
-class dns_update_system_records(Command):
-    __doc__ = _('Update location and IPA server DNS records')
-
-
-    has_output_params = (
+class dns_system_records(Object):
+    takes_params = (
         Str(
             'ipa_records*',
             label=_('IPA DNS records')
@@ -4423,11 +4421,17 @@ class dns_update_system_records(Command):
         )
     )
 
+
+@register()
+class dns_update_system_records(Method):
+    __doc__ = _('Update location and IPA server DNS records')
+
+    obj_name = 'dns_system_records'
+    attr_name = 'update'
+
     has_output = (
-        output.Output(
+        output.Entry(
             'result',
-            type=dict,
-            doc=_('Dictionary mapping variable name to value'),
         ),
         output.Output(
             'value', bool,
-- 
2.7.4

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to