summaryrefslogtreecommitdiffstats
path: root/install/tools
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-04-25 16:56:08 +0200
committerMartin Basti <mbasti@redhat.com>2016-05-24 10:17:02 +0200
commit9079d2f9c8a948702f1234e8337d8bf0dc291756 (patch)
tree832fa057845c9b754f940d6edc41948e51438427 /install/tools
parent65794fc71c6b76a8fe96423e3fac128dc5de2c7d (diff)
downloadfreeipa-9079d2f9c8a948702f1234e8337d8bf0dc291756.tar.gz
freeipa-9079d2f9c8a948702f1234e8337d8bf0dc291756.tar.xz
freeipa-9079d2f9c8a948702f1234e8337d8bf0dc291756.zip
ipa-nis-manage: add status option
https://fedorahosted.org/freeipa/ticket/5856 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com> Reviewed-By: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'install/tools')
-rwxr-xr-xinstall/tools/ipa-nis-manage22
-rw-r--r--install/tools/man/ipa-nis-manage.18
2 files changed, 24 insertions, 6 deletions
diff --git a/install/tools/ipa-nis-manage b/install/tools/ipa-nis-manage
index 948aa0046..f70961309 100755
--- a/install/tools/ipa-nis-manage
+++ b/install/tools/ipa-nis-manage
@@ -47,7 +47,7 @@ nis_config_dn = DN(('cn', 'NIS Server'), ('cn', 'plugins'), ('cn', 'config'))
compat_dn = DN(('cn', 'Schema Compatibility'), ('cn', 'plugins'), ('cn', 'config'))
def parse_options():
- usage = "%prog [options] <enable|disable>\n"
+ usage = "%prog [options] <enable|disable|status>\n"
usage += "%prog [options]\n"
parser = OptionParser(usage=usage, formatter=config.IPAFormatter())
@@ -96,8 +96,8 @@ def main():
options, args = parse_options()
if len(args) != 1:
- sys.exit("You must specify one action, either enable or disable")
- elif args[0] != "enable" and args[0] != "disable":
+ sys.exit("You must specify one action: enable | disable | status")
+ elif args[0] not in {"enable", "disable", "status"}:
sys.exit("Unrecognized action [" + args[0] + "]")
standard_logging_setup(None, debug=options.debug)
@@ -186,11 +186,25 @@ def main():
print(lde)
retval = 1
+ elif args[0] == "status":
+ nis_entry = get_entry(nis_config_dn, conn)
+ enabled = (nis_entry and
+ nis_entry.get(
+ 'nsslapd-pluginenabled', '')[0].lower() == "on")
+ if enabled:
+ print("Plugin is enabled")
+ retval = 0
+ else:
+ print("Plugin is not enabled")
+ retval = 4
+
else:
retval = 1
if retval == 0:
- print("This setting will not take effect until you restart Directory Server.")
+ if args[0] in {"enable", "disable"}:
+ print("This setting will not take effect until you restart "
+ "Directory Server.")
if args[0] == "enable":
print("The %s service may need to be started." % servicemsg)
diff --git a/install/tools/man/ipa-nis-manage.1 b/install/tools/man/ipa-nis-manage.1
index d60fda788..93278487c 100644
--- a/install/tools/man/ipa-nis-manage.1
+++ b/install/tools/man/ipa-nis-manage.1
@@ -20,13 +20,15 @@
.SH "NAME"
ipa\-nis\-manage \- Enables or disables the NIS listener plugin
.SH "SYNOPSIS"
-ipa\-nis\-manage [options] <enable|disable>
+ipa\-nis\-manage [options] <enable|disable|status>
.SH "DESCRIPTION"
Run the command with the \fBenable\fR option to enable the NIS plugin.
Run the command with the \fBdisable\fR option to disable the NIS plugin.
-In both cases the user will be prompted to provide the Directory Manager's password unless option \fB\-y\fR is used.
+Run the command with the \fBstatus\fR option to read status of the NIS plugin. Return code 0 indicates enabled plugin, return code 4 indicates disabled plugin.
+
+In all cases the user will be prompted to provide the Directory Manager's password unless option \fB\-y\fR is used.
Directory Server will need to be restarted after the NIS listener plugin has been enabled.
@@ -45,3 +47,5 @@ File containing the Directory Manager password
2 if the plugin is already in the required status (enabled or disabled)
3 if RPC services cannot be enabled.
+
+4 if status command detected plugin in disabled state.