This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.2
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.2 by this push:
new 3aae8c4 Ticket 50787 - fix implementation of attr unique
3aae8c4 is described below
commit 3aae8c429c3fb6edce6cab64e675d8fc561dbcd0
Author: William Brown <william(a)blackhats.net.au>
AuthorDate: Thu Jan 23 12:40:03 2020 +1000
Ticket 50787 - fix implementation of attr unique
Bug Description: The implementation of attribute unique relies
on a "plugin per config" which is different to most other
handlings. This creates an exception case to the standard
plugin framework in lib389 that was not correctly handled
in the CLI.
Fix Description: Fix the cli to have the correct customised
variants of the commands to support this plugin's behaviour.
dsconf localhost plugin attr-uniq status uid-test
Plugin
'uid-test' is disabled
dsconf localhost plugin attr-uniq enable uid-test
Successfully enabled the cn=uid-test,cn=plugins,cn=config
dsconf localhost plugin attr-uniq enable uid-test
Plugin
'uid-test' already enabled
dsconf localhost plugin attr-uniq status uid-test
Plugin
'uid-test' is enabled
dsconf localhost plugin attr-uniq disable uid-test
Successfully disabled the cn=uid-test,cn=plugins,cn=config
dsconf localhost plugin attr-uniq disable uid-test
Plugin
'uid-test' already disabled
https://pagure.io/389-ds-base/issue/50787
Author: William Brown <william(a)blackhats.net.au>
Review by: ???
---
src/lib389/lib389/cli_conf/plugins/attruniq.py | 40 +++++++++++++++++++++++---
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/lib389/lib389/cli_conf/plugins/attruniq.py
b/src/lib389/lib389/cli_conf/plugins/attruniq.py
index bfea80e..7f5bfb0 100644
--- a/src/lib389/lib389/cli_conf/plugins/attruniq.py
+++ b/src/lib389/lib389/cli_conf/plugins/attruniq.py
@@ -80,6 +80,38 @@ def attruniq_del(inst, basedn, log, args):
log.info("Successfully deleted the %s", plugin.dn)
+def attruniq_enable(inst, basedn, log, args):
+ log = log.getChild('attruniq_enable')
+ plugins = AttributeUniquenessPlugins(inst)
+ plugin = plugins.get(args.NAME)
+ if plugin.status():
+ log.info("Plugin '%s' already enabled" % plugin.rdn)
+ else:
+ plugin.enable()
+ log.info("Successfully enabled the %s", plugin.dn)
+
+
+def attruniq_disable(inst, basedn, log, args):
+ log = log.getChild('attruniq_disable')
+ plugins = AttributeUniquenessPlugins(inst)
+ plugin = plugins.get(args.NAME)
+ if not plugin.status():
+ log.info("Plugin '%s' already disabled" % plugin.rdn)
+ else:
+ plugin.disable()
+ log.info("Successfully disabled the %s", plugin.dn)
+
+
+def attruniq_status(inst, basedn, log, args):
+ log = log.getChild('attruniq_status')
+ plugins = AttributeUniquenessPlugins(inst)
+ plugin = plugins.get(args.NAME)
+ if plugin.status() is True:
+ log.info("Plugin '%s' is enabled" % plugin.rdn)
+ else:
+ log.info("Plugin '%s' is disabled" % plugin.rdn)
+
+
def _add_parser_args(parser):
parser.add_argument('NAME', help='Sets the name of the plug-in
configuration record. (cn) You can use any string, '
'but "attribute_name Attribute
Uniqueness" is recommended.')
@@ -106,7 +138,7 @@ def _add_parser_args(parser):
def create_parser(subparsers):
attruniq = subparsers.add_parser('attr-uniq', help='Manage and configure
Attribute Uniqueness plugin')
subcommands = attruniq.add_subparsers(help='action')
- add_generic_plugin_parsers(subcommands, AttributeUniquenessPlugin)
+ # We can't use the add_generic_plugin_parsers as we need named sub instances.
list = subcommands.add_parser('list', help='List available plugin
configs')
list.set_defaults(func=attruniq_list)
@@ -129,12 +161,12 @@ def create_parser(subparsers):
enable = subcommands.add_parser('enable', help='enable plugin')
enable.add_argument('NAME', help='Sets the name of the plug-in
configuration record')
- enable.set_defaults(func=generic_enable)
+ enable.set_defaults(func=attruniq_enable)
disable = subcommands.add_parser('disable', help='disable plugin')
disable.add_argument('NAME', help='Sets the name of the plug-in
configuration record')
- disable.set_defaults(func=generic_disable)
+ disable.set_defaults(func=attruniq_disable)
status = subcommands.add_parser('status', help='display plugin
status')
status.add_argument('NAME', help='Sets the name of the plug-in
configuration record')
- status.set_defaults(func=generic_status)
+ status.set_defaults(func=attruniq_status)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.