summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2015-05-26 12:11:04 +0000
committerJan Cholasta <jcholast@redhat.com>2015-05-26 12:16:31 +0000
commit41662eb9f02fc6bf1399508a13de8d6f18d7b3b1 (patch)
tree4a0d78ef75980466a7e1ead42b3108f87214711b /ipalib
parentf3010498af2a4b98512d219b8e09101176c172fe (diff)
downloadfreeipa-41662eb9f02fc6bf1399508a13de8d6f18d7b3b1.tar.gz
freeipa-41662eb9f02fc6bf1399508a13de8d6f18d7b3b1.tar.xz
freeipa-41662eb9f02fc6bf1399508a13de8d6f18d7b3b1.zip
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 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/constants.py1
-rw-r--r--ipalib/plugins/server.py89
2 files changed, 90 insertions, 0 deletions
diff --git a/ipalib/constants.py b/ipalib/constants.py
index b99306eae..95dec54a5 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:8888/ipa/xml'),
diff --git a/ipalib/plugins/server.py b/ipalib/plugins/server.py
new file mode 100644
index 000000000..d22f1ea36
--- /dev/null
+++ b/ipalib/plugins/server.py
@@ -0,0 +1,89 @@
+#
+# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
+#
+
+import string
+import os
+
+from ipalib import api
+from ipalib import Int, Str
+from ipalib.plugable import Registry
+from ipalib.plugins.baseldap import *
+from ipalib.plugins import baseldap
+from ipalib import _, ngettext
+
+__doc__ = _("""
+IPA servers
+""") + _("""
+Get information about installed IPA servers.
+""") + _("""
+EXAMPLES:
+""") + _("""
+ Find all servers:
+ ipa server-find
+""") + _("""
+ Show specific server:
+ ipa server-show ipa.example.com
+""")
+
+register = Registry()
+
+
+@register()
+class server(LDAPObject):
+ """
+ IPA server
+ """
+ container_dn = api.env.container_masters
+ object_name = _('server')
+ object_name_plural = _('servers')
+ object_class = ['top']
+ default_attributes = [
+ 'cn', 'iparepltopomanagedsuffix', 'ipamindomainlevel',
+ 'ipamaxdomainlevel'
+ ]
+ label = _('IPA Servers')
+ label_singular = _('IPA Server')
+ takes_params = (
+ Str(
+ 'cn',
+ cli_name='name',
+ primary_key=True,
+ label=_('Server name'),
+ doc=_('IPA server hostname'),
+ ),
+ Str(
+ 'iparepltopomanagedsuffix',
+ cli_name='suffix',
+ label=_('Managed suffix'),
+ ),
+ Int(
+ 'ipamindomainlevel',
+ cli_name='minlevel',
+ label=_('Min domain level'),
+ doc=_('Minimum domain level'),
+ flags={'no_create', 'no_update'},
+ ),
+ Int(
+ 'ipamaxdomainlevel',
+ cli_name='maxlevel',
+ label=_('Max domain level'),
+ doc=_('Maximum domain level'),
+ flags={'no_create', 'no_update'},
+ ),
+ )
+
+
+@register()
+class server_find(LDAPSearch):
+ __doc__ = _('Search for IPA servers.')
+
+ msg_summary = ngettext(
+ '%(count)d IPA server matched',
+ '%(count)d IPA servers matched', 0
+ )
+
+
+@register()
+class server_show(LDAPRetrieve):
+ __doc__ = _('Show IPA server.')