This is an automated email from the git hooks/post-receive script.
firstyear 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 7a09961 Ticket 50667 - dsctl -l did not respect PREFIX
7a09961 is described below
commit 7a09961fb6b0905b3b6329f8016dca0e2b6d5f29
Author: William Brown <william(a)blackhats.net.au>
AuthorDate: Wed Oct 23 12:01:04 2019 +1000
Ticket 50667 - dsctl -l did not respect PREFIX
Bug Description: dsctl list was not coded to allow
using the paths module.
Fix Description: Change to the paths module to allow
better and consistent CLI handling.
https://pagure.io/389-ds-base/issue/50667
Author: William Brown <william(a)blackhats.net.au>
Review by: mreynolds, spichugi (thanks)
---
src/lib389/cli/dsctl | 4 ++--
src/lib389/lib389/cli_ctl/instance.py | 2 +-
src/lib389/lib389/utils.py | 8 ++++++--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/lib389/cli/dsctl b/src/lib389/cli/dsctl
index 8484f86..a4a5f9c 100755
--- a/src/lib389/cli/dsctl
+++ b/src/lib389/cli/dsctl
@@ -47,8 +47,8 @@ parser.add_argument('-l', '--list',
default=False, action='store_true'
)
-parser.add_argument('--remove-all', nargs="?", default=False,
const=None,
- help="Remove all instances of Directory Server (you can also provide an
optional directory prefix for this argument)",
+parser.add_argument('--remove-all', default=False, action='store_true',
+ help=argparse.SUPPRESS
)
subparsers = parser.add_subparsers(help="action")
diff --git a/src/lib389/lib389/cli_ctl/instance.py
b/src/lib389/lib389/cli_ctl/instance.py
index 95958e1..f0111f3 100644
--- a/src/lib389/lib389/cli_ctl/instance.py
+++ b/src/lib389/lib389/cli_ctl/instance.py
@@ -127,7 +127,7 @@ def instance_remove_all(log, args):
"""Remove all instances - clean sweep!
"""
- inst_names = get_instance_list(args.remove_all)
+ inst_names = get_instance_list()
if len(inst_names) > 0:
answer = input("Are you sure you want to remove all the Directory Server
instances? Enter \"Yes\" to continue: ")
if answer != 'Yes':
diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py
index 36422dd..2951136 100644
--- a/src/lib389/lib389/utils.py
+++ b/src/lib389/lib389/utils.py
@@ -1249,9 +1249,10 @@ def get_ldapurl_from_serverid(instance):
return ("ldap://{}:{}".format(host, port), None)
-def get_instance_list(prefix=None):
+def get_instance_list():
# List all server instances
- conf_dir = (prefix or "") + "/etc/dirsrv/"
+ paths = Paths()
+ conf_dir = os.path.join(paths.sysconf_dir, 'dirsrv')
insts = []
try:
for inst in os.listdir(conf_dir):
@@ -1259,6 +1260,9 @@ def get_instance_list(prefix=None):
insts.append(inst)
except OSError as e:
log.error("Failed to check directory: {} - {}".format(conf_dir,
str(e)))
+ except IOError as e:
+ log.error(e)
+ log.error("Perhaps you need to be a different user?")
insts.sort()
return insts
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.