Re: [Freeipa-devel] [PATCH] 855 server-find and server-show commands

2015-05-26 Thread Petr Vobornik

On 05/26/2015 12:14 PM, Petr Vobornik wrote:

the patch is rebased on top of tbabej 325-9 (but it might not be needed)

   ipa server-find
   ipa server-show FQDN

These commands display a list of IPA servers stored in
cn=masters,cn=ipa,cn=etc,$SUFFIX

https://fedorahosted.org/freeipa/ticket/4302 (maybe we could create a
different one)



minor update based on Honza's offline comments
--
Petr Vobornik
From 3886f796cc6ab4922b5ae3360be533aa9b619275 Mon Sep 17 00:00:00 2001
From: Petr Vobornik pvobo...@redhat.com
Date: Fri, 22 May 2015 09:43:27 +0200
Subject: [PATCH] server-find and server-show commands

  ipa server-find
  ipa server-show FQDN

These commands display a list of IPA servers stored in cn=masters,cn=ipa,cn=etc,$SUFFIX

https://fedorahosted.org/freeipa/ticket/4302
---
 API.txt  | 27 +++
 VERSION  |  4 +--
 ipalib/constants.py  |  1 +
 ipalib/plugins/server.py | 89 
 4 files changed, 119 insertions(+), 2 deletions(-)
 create mode 100644 ipalib/plugins/server.py

diff --git a/API.txt b/API.txt
index 835dd820e3fb1aedbe8579c9e57e767569e2079b..92e26d63d7c402a4029ccc4b91ce03ea15128a99 100644
--- a/API.txt
+++ b/API.txt
@@ -3545,6 +3545,33 @@ option: Str('version?', exclude='webui')
 output: Entry('result', type 'dict', Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
 output: Output('summary', (type 'unicode', type 'NoneType'), None)
 output: PrimaryKey('value', None, None)
+command: server_find
+args: 1,10,4
+arg: Str('criteria?', noextrawhitespace=False)
+option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
+option: Str('cn', attribute=True, autofill=False, cli_name='name', multivalue=False, primary_key=True, query=True, required=False)
+option: Int('ipamaxdomainlevel', attribute=True, autofill=False, cli_name='maxlevel', multivalue=False, query=True, required=False)
+option: Int('ipamindomainlevel', attribute=True, autofill=False, cli_name='minlevel', multivalue=False, query=True, required=False)
+option: Str('iparepltopomanagedsuffix', attribute=True, autofill=False, cli_name='suffix', multivalue=False, query=True, required=False)
+option: Flag('pkey_only?', autofill=True, default=False)
+option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
+option: Int('sizelimit?', autofill=False, minvalue=0)
+option: Int('timelimit?', autofill=False, minvalue=0)
+option: Str('version?', exclude='webui')
+output: Output('count', type 'int', None)
+output: ListOfEntries('result', (type 'list', type 'tuple'), Gettext('A list of LDAP entries', domain='ipa', localedir=None))
+output: Output('summary', (type 'unicode', type 'NoneType'), None)
+output: Output('truncated', type 'bool', None)
+command: server_show
+args: 1,4,3
+arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, query=True, required=True)
+option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
+option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
+option: Flag('rights', autofill=True, default=False)
+option: Str('version?', exclude='webui')
+output: Entry('result', type 'dict', Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
+output: Output('summary', (type 'unicode', type 'NoneType'), None)
+output: PrimaryKey('value', None, None)
 command: service_add
 args: 1,11,3
 arg: Str('krbprincipalname', attribute=True, cli_name='principal', multivalue=False, primary_key=True, required=True)
diff --git a/VERSION b/VERSION
index 33e7bebe4c673279ae92395a2575dc11e9fd4956..b124805d9bbcdb6628f9b05276e45487d718a0e8 100644
--- a/VERSION
+++ b/VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=2010061412
 #  #
 
 IPA_API_VERSION_MAJOR=2
-IPA_API_VERSION_MINOR=119
-# Last change: edewata - Added vault plugin
+IPA_API_VERSION_MINOR=120
+# Last change: pvoborni - added server-find and server-show
diff --git a/ipalib/constants.py b/ipalib/constants.py
index b99306eaec1d7bcbec4612a8aa4a599d02ac73e5..95dec54a51f38ae63eba667daacf35dcd7500cf3 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -117,6 +117,7 @@ DEFAULT_CONFIG = (
 ('container_otp', DN(('cn', 'otp'))),
 ('container_radiusproxy', DN(('cn', 'radiusproxy'))),
 ('container_views', DN(('cn', 'views'), ('cn', 'accounts'))),
+('container_masters', DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'))),
 
 # Ports, hosts, and URIs:
 ('xmlrpc_uri', 'http://localhost:/ipa/xml'),
diff --git a/ipalib/plugins/server.py b/ipalib/plugins/server.py
new file mode 100644
index ..d22f1ea368ad09ab2cff00429f509c99d92f0f60
--- /dev/null
+++ b/ipalib/plugins/server.py
@@ -0,0 +1,89 @@
+#
+# Copyright (C) 2015  FreeIPA Contributors see COPYING for 

Re: [Freeipa-devel] [PATCH] 855 server-find and server-show commands

2015-05-26 Thread Jan Cholasta

Dne 26.5.2015 v 13:03 Petr Vobornik napsal(a):

On 05/26/2015 12:14 PM, Petr Vobornik wrote:

the patch is rebased on top of tbabej 325-9 (but it might not be needed)

   ipa server-find
   ipa server-show FQDN

These commands display a list of IPA servers stored in
cn=masters,cn=ipa,cn=etc,$SUFFIX

https://fedorahosted.org/freeipa/ticket/4302 (maybe we could create a
different one)



minor update based on Honza's offline comments


Thanks, ACK.

Rebased and pushed to master: 41662eb9f02fc6bf1399508a13de8d6f18d7b3b1

--
Jan Cholasta

--
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