#49868 Ticket 49867 - Fix CLI tools' double output
Closed 3 years ago by spichugi. Opened 5 years ago by mreynolds.
mreynolds/389-ds-base ticket49867  into  master

file modified
+2 -7
@@ -15,10 +15,6 @@ 

  import ldap

  import sys

  import signal

- 

- # This has to happen before we import  DirSrv else it tramples our config ... :(

- logging.basicConfig(format='%(message)s')

- 

  from lib389 import DirSrv

  from lib389._constants import DN_CONFIG, DN_DM

  from lib389.cli_conf import config as cli_config
@@ -34,13 +30,11 @@ 

  from lib389.cli_conf.plugins import whoami as cli_whoami

  from lib389.cli_conf.plugins import referint as cli_referint

  from lib389.cli_conf.plugins import automember as cli_automember

- 

  from lib389.cli_base import disconnect_instance, connect_instance

- 

  from lib389.cli_base.dsrc import dsrc_to_ldap, dsrc_arg_concat

- 

  from lib389.cli_base import setup_script_logger

  

+ 

  parser = argparse.ArgumentParser(allow_abbrev=True)

  parser.add_argument('instance',

          help="The instance name OR the LDAP url to connect to, IE localhost, ldap://mai.example.com:389",
@@ -81,6 +75,7 @@ 

  cli_referint.create_parser(subparsers)

  cli_automember.create_parser(subparsers)

  cli_sasl.create_parser(subparsers)

+ 

  argcomplete.autocomplete(parser)

  

  # handle a control-c gracefully

file modified
+1 -1
@@ -14,7 +14,6 @@ 

  import logging

  import sys

  import signal

- 

  from lib389 import DirSrv

  from lib389.cli_ctl import instance as cli_instance

  from lib389.cli_base import setup_script_logger
@@ -39,6 +38,7 @@ 

  template_parser = subparsers.add_parser('create-template', help="Display an example inf answer file, or provide a file name to write it to disk.")

  template_parser.add_argument('template_file', nargs="?", default=None, help="Write example template to this file")

  template_parser.set_defaults(func=cli_instance.instance_example)

+ 

  argcomplete.autocomplete(parser)

  

  # handle a control-c gracefully

file modified
+1 -6
@@ -14,10 +14,6 @@ 

  import logging

  import sys

  import signal

- 

- # This has to happen before we import  DirSrv else it tramples our config ... :(

- logging.basicConfig(format='%(message)s')

- 

  from lib389.cli_base import _get_arg

  from lib389 import DirSrv

  from lib389.cli_ctl import instance as cli_instance
@@ -37,11 +33,10 @@ 

          default=False, action='store_true'

      )

  subparsers = parser.add_subparsers(help="action")

- argcomplete.autocomplete(parser)

- # We stack our needed options in via submodules.

  cli_instance.create_parser(subparsers)

  cli_dbtasks.create_parser(subparsers)

  

+ argcomplete.autocomplete(parser)

  

  # handle a control-c gracefully

  def signal_handler(signal, frame):

file modified
+2 -6
@@ -15,10 +15,6 @@ 

  import logging

  import sys

  import signal

- 

- # This has to happen before we import  DirSrv else it tramples our config ... :(

- logging.basicConfig(format='%(message)s')

- 

  from lib389._constants import DN_DM

  from lib389.cli_idm import account as cli_account

  from lib389.cli_idm import initialise as cli_init
@@ -26,11 +22,10 @@ 

  from lib389.cli_idm import group as cli_group

  from lib389.cli_idm import posixgroup as cli_posixgroup

  from lib389.cli_idm import user as cli_user

- 

  from lib389.cli_base import connect_instance, disconnect_instance, setup_script_logger

- 

  from lib389.cli_base.dsrc import dsrc_to_ldap, dsrc_arg_concat

  

+ 

  parser = argparse.ArgumentParser(allow_abbrev=True)

  # First, add the LDAP options

  parser.add_argument('instance',
@@ -64,6 +59,7 @@ 

  cli_ou.create_parser(subparsers)

  cli_posixgroup.create_parser(subparsers)

  cli_user.create_parser(subparsers)

+ 

  argcomplete.autocomplete(parser)

  

  # handle a control-c gracefully

Description: This is a regression from a previous fix. Do not call
logging.basicConfig() in cli tools

https://pagure.io/389-ds-base/issue/49867

Reviewed by: ?

rebased onto 52b8997

5 years ago

Pull-Request has been merged by mreynolds

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/2927

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago