- Resolves: RHEL-73022 A slow HSM can cause IPA server installation to fail setting up certificate tracking [rhel-9] - Resolves: RHEL-71261 [RHEL-9.6] Include latest fixes in python3-ipatests package - Resolves: RHEL-67191 CVE-2024-11029 ipa: Administrative user data leaked through systemd journal [rhel-9.6] - Resolves: RHEL-59040 KRA installation failure caused by a certificate mismatch in NSS DB and configuration file. Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
625 lines
25 KiB
Diff
625 lines
25 KiB
Diff
From d26ce5cccc211f83b3cce3fc5e548b5cb955bb81 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Bokovoy <abokovoy@redhat.com>
|
|
Date: Fri, 13 Dec 2024 13:42:36 +0200
|
|
Subject: [PATCH] Unify use of option parsers
|
|
|
|
Do not use direct optparse references, instead import IPAOptionParser
|
|
|
|
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
|
|
---
|
|
install/tools/ipa-adtrust-install.in | 4 +---
|
|
install/tools/ipa-managed-entries.in | 3 ++-
|
|
ipaclient/install/ipa_client_automount.py | 4 ++--
|
|
ipaclient/install/ipa_client_samba.py | 4 ++--
|
|
ipalib/cli.py | 21 ++++++++++++---------
|
|
ipalib/plugable.py | 8 ++++----
|
|
ipapython/admintool.py | 3 +--
|
|
ipapython/config.py | 18 +++++++++++-------
|
|
ipapython/install/cli.py | 9 ++++-----
|
|
ipaserver/install/ipa_acme_manage.py | 6 ++----
|
|
ipaserver/install/ipa_backup.py | 5 ++---
|
|
ipaserver/install/ipa_cacert_manage.py | 9 ++++-----
|
|
ipaserver/install/ipa_kra_install.py | 5 ++---
|
|
ipaserver/install/ipa_restore.py | 5 ++---
|
|
ipaserver/install/ipa_server_certinstall.py | 7 +++----
|
|
ipatests/i18n.py | 8 ++++----
|
|
makeapi.in | 5 ++---
|
|
17 files changed, 60 insertions(+), 64 deletions(-)
|
|
|
|
diff --git a/install/tools/ipa-adtrust-install.in b/install/tools/ipa-adtrust-install.in
|
|
index cb2b78e504896b96cdc378fd879cc1f00c60904f..e7b0e369259da5d28d703558d9293ccfaf68f3ed 100644
|
|
--- a/install/tools/ipa-adtrust-install.in
|
|
+++ b/install/tools/ipa-adtrust-install.in
|
|
@@ -29,8 +29,6 @@ import sys
|
|
|
|
import six
|
|
|
|
-from optparse import SUPPRESS_HELP # pylint: disable=deprecated-module
|
|
-
|
|
from ipalib.install import sysrestore
|
|
from ipaserver.install import adtrust, service
|
|
from ipaserver.install.installutils import (
|
|
@@ -41,7 +39,7 @@ from ipapython.admintool import ScriptError
|
|
from ipapython import version
|
|
from ipapython import ipautil
|
|
from ipalib import api, errors, krb_utils
|
|
-from ipapython.config import IPAOptionParser
|
|
+from ipapython.config import IPAOptionParser, SUPPRESS_HELP
|
|
from ipaplatform.paths import paths
|
|
from ipapython.ipa_log_manager import standard_logging_setup
|
|
|
|
diff --git a/install/tools/ipa-managed-entries.in b/install/tools/ipa-managed-entries.in
|
|
index e9be41b7a34ed62e65ab40bf544a6e4cea7c598a..e3f121943eb3b18ca8f7f8bfeae7813cbc9bd753 100644
|
|
--- a/install/tools/ipa-managed-entries.in
|
|
+++ b/install/tools/ipa-managed-entries.in
|
|
@@ -39,7 +39,8 @@ logger = logging.getLogger(os.path.basename(__file__))
|
|
def parse_options():
|
|
usage = "%prog [options] <status|enable|disable>\n"
|
|
usage += "%prog [options]\n"
|
|
- parser = OptionParser(usage=usage, formatter=config.IPAFormatter())
|
|
+ parser = config.IPAOptionParser(usage=usage,
|
|
+ formatter=config.IPAFormatter())
|
|
|
|
parser.add_option("-d", "--debug", action="store_true", dest="debug",
|
|
help="Display debugging information about the update(s)")
|
|
diff --git a/ipaclient/install/ipa_client_automount.py b/ipaclient/install/ipa_client_automount.py
|
|
index 4439932bd723c40c429dac2c08e97d326e414d24..9f49ff9edeee2648d2be1dea6b09806ba0b5e041 100644
|
|
--- a/ipaclient/install/ipa_client_automount.py
|
|
+++ b/ipaclient/install/ipa_client_automount.py
|
|
@@ -34,7 +34,6 @@ import SSSDConfig
|
|
|
|
from six.moves.urllib.parse import urlsplit
|
|
|
|
-from optparse import OptionParser # pylint: disable=deprecated-module
|
|
from ipapython import ipachangeconf
|
|
from ipaclient import discovery
|
|
from ipaclient.install.client import (
|
|
@@ -52,6 +51,7 @@ from ipaplatform.tasks import tasks
|
|
from ipaplatform import services
|
|
from ipaplatform.paths import paths
|
|
from ipapython.admintool import ScriptError
|
|
+from ipapython.config import IPAOptionParser
|
|
|
|
|
|
logger = logging.getLogger(os.path.basename(__file__))
|
|
@@ -59,7 +59,7 @@ logger = logging.getLogger(os.path.basename(__file__))
|
|
|
|
def parse_options():
|
|
usage = "%prog [options]\n"
|
|
- parser = OptionParser(usage=usage)
|
|
+ parser = IPAOptionParser(usage=usage)
|
|
parser.add_option("--server", dest="server", help="FQDN of IPA server")
|
|
parser.add_option(
|
|
"--location",
|
|
diff --git a/ipaclient/install/ipa_client_samba.py b/ipaclient/install/ipa_client_samba.py
|
|
index 81d670c34cae0f91a436a2a2d1e0d525057b6cc7..5c33abb4cabe47ff311b7d769fefa37991f7d453 100755
|
|
--- a/ipaclient/install/ipa_client_samba.py
|
|
+++ b/ipaclient/install/ipa_client_samba.py
|
|
@@ -9,7 +9,6 @@ import logging
|
|
import os
|
|
import gssapi
|
|
from urllib.parse import urlsplit
|
|
-from optparse import OptionParser # pylint: disable=deprecated-module
|
|
from contextlib import contextmanager
|
|
|
|
from ipaclient import discovery
|
|
@@ -31,6 +30,7 @@ from ipaplatform.constants import constants
|
|
from ipaplatform import services
|
|
from ipapython.admintool import ScriptError
|
|
from samba import generate_random_password
|
|
+from ipapython.config import IPAOptionParser
|
|
|
|
logger = logging.getLogger(os.path.basename(__file__))
|
|
logger.setLevel(logging.DEBUG)
|
|
@@ -68,7 +68,7 @@ def use_api_as_principal(principal, keytab):
|
|
|
|
def parse_options():
|
|
usage = "%prog [options]\n"
|
|
- parser = OptionParser(usage=usage)
|
|
+ parser = IPAOptionParser(usage=usage)
|
|
parser.add_option(
|
|
"--server",
|
|
dest="server",
|
|
diff --git a/ipalib/cli.py b/ipalib/cli.py
|
|
index d9c2ac16513101098c8f9a2258ae930b3b2cebf0..667b213fd4e4706e6eecd4d2b4737fb3fede4c93 100644
|
|
--- a/ipalib/cli.py
|
|
+++ b/ipalib/cli.py
|
|
@@ -30,7 +30,6 @@ import textwrap
|
|
import sys
|
|
import getpass
|
|
import code
|
|
-import optparse # pylint: disable=deprecated-module
|
|
import os
|
|
import pprint
|
|
import fcntl
|
|
@@ -71,6 +70,8 @@ from ipalib.text import _
|
|
from ipalib import api
|
|
from ipapython.dnsutil import DNSName
|
|
from ipapython.admintool import ScriptError
|
|
+from ipapython.config import (IPAOptionParser, IPAFormatter,
|
|
+ OptionGroup, make_option)
|
|
|
|
import datetime
|
|
|
|
@@ -1121,7 +1122,8 @@ class Collector:
|
|
def __todict__(self):
|
|
return dict(self.__options)
|
|
|
|
-class CLIOptionParserFormatter(optparse.IndentedHelpFormatter):
|
|
+
|
|
+class CLIOptionParserFormatter(IPAFormatter):
|
|
def format_argument(self, name, help_string):
|
|
result = []
|
|
opt_width = self.help_position - self.current_indent - 2
|
|
@@ -1141,7 +1143,8 @@ class CLIOptionParserFormatter(optparse.IndentedHelpFormatter):
|
|
result.append("\n")
|
|
return "".join(result)
|
|
|
|
-class CLIOptionParser(optparse.OptionParser):
|
|
+
|
|
+class CLIOptionParser(IPAOptionParser):
|
|
"""
|
|
This OptionParser subclass adds an ability to print positional
|
|
arguments in CLI help. Custom formatter is used to format the argument
|
|
@@ -1151,13 +1154,13 @@ class CLIOptionParser(optparse.OptionParser):
|
|
self._arguments = []
|
|
if 'formatter' not in kwargs:
|
|
kwargs['formatter'] = CLIOptionParserFormatter()
|
|
- optparse.OptionParser.__init__(self, *args, **kwargs)
|
|
+ IPAOptionParser.__init__(self, *args, **kwargs)
|
|
|
|
def format_option_help(self, formatter=None):
|
|
"""
|
|
Prepend argument help to standard OptionParser's option help
|
|
"""
|
|
- option_help = optparse.OptionParser.format_option_help(self, formatter)
|
|
+ option_help = IPAOptionParser.format_option_help(self, formatter)
|
|
|
|
if isinstance(formatter, CLIOptionParserFormatter):
|
|
heading = unicode(_("Positional arguments"))
|
|
@@ -1272,7 +1275,7 @@ class cli(backend.Executioner):
|
|
"""Get or create an option group for the given name"""
|
|
option_group = option_groups.get(group_name)
|
|
if option_group is None:
|
|
- option_group = optparse.OptionGroup(parser, group_name)
|
|
+ option_group = OptionGroup(parser, group_name)
|
|
parser.add_option_group(option_group)
|
|
option_groups[group_name] = option_group
|
|
return option_group
|
|
@@ -1298,7 +1301,7 @@ class cli(backend.Executioner):
|
|
option_names = ['--%s' % cli_name]
|
|
if option.cli_short_name:
|
|
option_names.append('-%s' % option.cli_short_name)
|
|
- opt = optparse.make_option(*option_names, **kw)
|
|
+ opt = make_option(*option_names, **kw)
|
|
if option.option_group is None:
|
|
parser.add_option(opt)
|
|
else:
|
|
@@ -1312,7 +1315,7 @@ class cli(backend.Executioner):
|
|
group = _get_option_group(unicode(_('Deprecated options')))
|
|
for alias in option.deprecated_cli_aliases:
|
|
name = '--%s' % alias
|
|
- group.add_option(optparse.make_option(name, **new_kw))
|
|
+ group.add_option(make_option(name, **new_kw))
|
|
|
|
for arg in cmd.args():
|
|
name = self.__get_arg_name(arg, format_name=False)
|
|
@@ -1442,7 +1445,7 @@ class cli(backend.Executioner):
|
|
)
|
|
|
|
|
|
-class IPAHelpFormatter(optparse.IndentedHelpFormatter):
|
|
+class IPAHelpFormatter(IPAFormatter):
|
|
"""Formatter suitable for printing IPA command help
|
|
|
|
The default help formatter reflows text to fit the terminal, but it
|
|
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
|
|
index 2e2861df054fa7ed3533d0f82a23b65322ab591b..a87e6e8914fa5579920aad8190c7f6a86cb3dfea 100644
|
|
--- a/ipalib/plugable.py
|
|
+++ b/ipalib/plugable.py
|
|
@@ -33,7 +33,6 @@ import sys
|
|
import threading
|
|
import os
|
|
from os import path
|
|
-import optparse # pylint: disable=deprecated-module
|
|
import textwrap
|
|
import collections
|
|
import importlib
|
|
@@ -47,6 +46,7 @@ from ipalib.util import classproperty
|
|
from ipalib.base import ReadOnly, lock, islocked
|
|
from ipalib.constants import DEFAULT_CONFIG
|
|
from ipapython import ipa_log_manager, ipautil
|
|
+from ipapython.config import IPAOptionParser, IPAFormatter
|
|
from ipapython.ipa_log_manager import (
|
|
LOGGING_FORMAT_FILE,
|
|
LOGGING_FORMAT_STDERR)
|
|
@@ -526,7 +526,7 @@ class API(ReadOnly):
|
|
|
|
def build_global_parser(self, parser=None, context=None):
|
|
"""
|
|
- Add global options to an optparse.OptionParser instance.
|
|
+ Add global options to an IPAOptionParser instance.
|
|
"""
|
|
def config_file_callback(option, opt, value, parser):
|
|
if not os.path.isfile(value):
|
|
@@ -536,7 +536,7 @@ class API(ReadOnly):
|
|
parser.values.conf = value
|
|
|
|
if parser is None:
|
|
- parser = optparse.OptionParser(
|
|
+ parser = IPAOptionParser(
|
|
add_help_option=False,
|
|
formatter=IPAHelpFormatter(),
|
|
usage='%prog [global-options] COMMAND [command-options]',
|
|
@@ -821,7 +821,7 @@ class API(ReadOnly):
|
|
return self.__next[plugin]
|
|
|
|
|
|
-class IPAHelpFormatter(optparse.IndentedHelpFormatter):
|
|
+class IPAHelpFormatter(IPAFormatter):
|
|
def format_epilog(self, epilog):
|
|
text_width = self.width - self.current_indent
|
|
indent = " " * self.current_indent
|
|
diff --git a/ipapython/admintool.py b/ipapython/admintool.py
|
|
index fdb4400d879165612405b3ba159a220773bd8d69..dff9112eba4009d2fc1a6202756c6671ba4d909d 100644
|
|
--- a/ipapython/admintool.py
|
|
+++ b/ipapython/admintool.py
|
|
@@ -26,7 +26,6 @@ import logging
|
|
import sys
|
|
import os
|
|
import traceback
|
|
-from optparse import OptionGroup # pylint: disable=deprecated-module
|
|
|
|
from ipaplatform.osinfo import osinfo
|
|
from ipapython import version
|
|
@@ -113,7 +112,7 @@ class AdminTool:
|
|
:param parser: The parser to add options to
|
|
:param debug_option: Add a --debug option as an alias to --verbose
|
|
"""
|
|
- group = OptionGroup(parser, "Logging and output options")
|
|
+ group = config.OptionGroup(parser, "Logging and output options")
|
|
group.add_option("-v", "--verbose", dest="verbose", default=False,
|
|
action="store_true", help="print debugging information")
|
|
if debug_option:
|
|
diff --git a/ipapython/config.py b/ipapython/config.py
|
|
index f53d0f998aaedf47715764577dd7f5048f4ca841..7af4dfdeb0047586de9694f233be8bf543190b9c 100644
|
|
--- a/ipapython/config.py
|
|
+++ b/ipapython/config.py
|
|
@@ -18,9 +18,9 @@
|
|
#
|
|
from __future__ import absolute_import
|
|
|
|
-# pylint: disable=deprecated-module
|
|
-from optparse import (
|
|
- Option, Values, OptionParser, IndentedHelpFormatter, OptionValueError)
|
|
+# pylint: disable=deprecated-module, disable=unused-import
|
|
+from optparse import (Option, Values, OptionGroup, OptionParser, SUPPRESS_HELP,
|
|
+ IndentedHelpFormatter, OptionValueError, make_option)
|
|
# pylint: enable=deprecated-module
|
|
from copy import copy
|
|
from configparser import ConfigParser as SafeConfigParser
|
|
@@ -113,10 +113,14 @@ class IPAOptionParser(OptionParser):
|
|
description=None,
|
|
formatter=None,
|
|
add_help_option=True,
|
|
- prog=None):
|
|
- OptionParser.__init__(self, usage, option_list, option_class,
|
|
- version, conflict_handler, description,
|
|
- formatter, add_help_option, prog)
|
|
+ prog=None,
|
|
+ epilog=None):
|
|
+ OptionParser.__init__(self, usage=usage, option_list=option_list,
|
|
+ option_class=option_class, version=version,
|
|
+ conflict_handler=conflict_handler,
|
|
+ description=description, formatter=formatter,
|
|
+ add_help_option=add_help_option, prog=prog,
|
|
+ epilog=epilog)
|
|
|
|
def get_safe_opts(self, opts):
|
|
"""
|
|
diff --git a/ipapython/install/cli.py b/ipapython/install/cli.py
|
|
index ab212be4e2c3f9c2aae97f7759672ef7c68c3347..a048b3c7c64bc22338e4517d64b33a44446c58a3 100644
|
|
--- a/ipapython/install/cli.py
|
|
+++ b/ipapython/install/cli.py
|
|
@@ -9,12 +9,11 @@ Command line support.
|
|
import collections
|
|
import enum
|
|
import logging
|
|
-import optparse # pylint: disable=deprecated-module
|
|
import signal
|
|
|
|
import six
|
|
|
|
-from ipapython import admintool
|
|
+from ipapython import admintool, config
|
|
from ipapython.ipa_log_manager import standard_logging_setup
|
|
from ipapython.ipautil import (CheckedIPAddress, CheckedIPAddressLoopback,
|
|
private_ccache)
|
|
@@ -158,7 +157,7 @@ class ConfigureTool(admintool.AdminTool):
|
|
try:
|
|
opt_group = groups[group_cls]
|
|
except KeyError:
|
|
- opt_group = groups[group_cls] = optparse.OptionGroup(
|
|
+ opt_group = groups[group_cls] = config.OptionGroup(
|
|
parser, "{0} options".format(group_cls.description))
|
|
parser.add_option_group(opt_group)
|
|
|
|
@@ -232,7 +231,7 @@ class ConfigureTool(admintool.AdminTool):
|
|
if not hidden:
|
|
help = knob_cls.description
|
|
else:
|
|
- help = optparse.SUPPRESS_HELP
|
|
+ help = config.SUPPRESS_HELP
|
|
|
|
opt_group.add_option(
|
|
*opt_strs,
|
|
@@ -256,7 +255,7 @@ class ConfigureTool(admintool.AdminTool):
|
|
|
|
# fake option parser to parse positional arguments
|
|
# (because optparse does not support positional argument parsing)
|
|
- fake_option_parser = optparse.OptionParser()
|
|
+ fake_option_parser = config.IPAOptionParser()
|
|
self.add_options(fake_option_parser, True)
|
|
|
|
fake_option_map = {option.dest: option
|
|
diff --git a/ipaserver/install/ipa_acme_manage.py b/ipaserver/install/ipa_acme_manage.py
|
|
index dc2359f49dfdd5c8f44ab96ee11a7240f8937e11..0decab394c1c18067fe0c194c040805a8d93d42d 100644
|
|
--- a/ipaserver/install/ipa_acme_manage.py
|
|
+++ b/ipaserver/install/ipa_acme_manage.py
|
|
@@ -7,14 +7,12 @@ import enum
|
|
import pki.util
|
|
import logging
|
|
|
|
-from optparse import OptionGroup # pylint: disable=deprecated-module
|
|
-
|
|
from ipalib import api, errors, x509
|
|
from ipalib import _
|
|
from ipalib.facts import is_ipa_configured
|
|
from ipaplatform.paths import paths
|
|
from ipapython.admintool import AdminTool
|
|
-from ipapython import cookie, dogtag
|
|
+from ipapython import cookie, dogtag, config
|
|
from ipapython.ipautil import run
|
|
from ipapython.certdb import NSSDatabase, EXTERNAL_CA_TRUST_FLAGS
|
|
from ipaserver.install import cainstance
|
|
@@ -143,7 +141,7 @@ class IPAACMEManage(AdminTool):
|
|
@classmethod
|
|
def add_options(cls, parser):
|
|
|
|
- group = OptionGroup(parser, 'Pruning')
|
|
+ group = config.OptionGroup(parser, 'Pruning')
|
|
group.add_option(
|
|
"--enable", dest="enable", action="store_true",
|
|
default=False, help="Enable certificate pruning")
|
|
diff --git a/ipaserver/install/ipa_backup.py b/ipaserver/install/ipa_backup.py
|
|
index 982e5dfc4c0339aada88f936ab450b7fc16944f2..b6af63813fc4eaadab44ad95386d86ae4f1e21ee 100644
|
|
--- a/ipaserver/install/ipa_backup.py
|
|
+++ b/ipaserver/install/ipa_backup.py
|
|
@@ -20,7 +20,6 @@
|
|
from __future__ import absolute_import, print_function
|
|
|
|
import logging
|
|
-import optparse # pylint: disable=deprecated-module
|
|
import os
|
|
import shutil
|
|
import sys
|
|
@@ -32,7 +31,7 @@ import six
|
|
from ipaplatform.paths import paths
|
|
from ipaplatform import services
|
|
from ipalib import api, errors
|
|
-from ipapython import version
|
|
+from ipapython import version, config
|
|
from ipapython.ipautil import run, write_tmp_file
|
|
from ipapython import admintool, certdb
|
|
from ipapython.dn import DN
|
|
@@ -245,7 +244,7 @@ class Backup(admintool.AdminTool):
|
|
|
|
parser.add_option(
|
|
"--gpg-keyring", dest="gpg_keyring",
|
|
- help=optparse.SUPPRESS_HELP)
|
|
+ help=config.SUPPRESS_HELP)
|
|
parser.add_option(
|
|
"--gpg", dest="gpg", action="store_true",
|
|
default=False, help="Encrypt the backup")
|
|
diff --git a/ipaserver/install/ipa_cacert_manage.py b/ipaserver/install/ipa_cacert_manage.py
|
|
index f6ab736fa985b00ba66a7001c4c4e2188841bcbe..048245237855212afe1f3ec4795b2253026ef864 100644
|
|
--- a/ipaserver/install/ipa_cacert_manage.py
|
|
+++ b/ipaserver/install/ipa_cacert_manage.py
|
|
@@ -22,14 +22,13 @@ from __future__ import print_function, absolute_import
|
|
import datetime
|
|
import logging
|
|
import os
|
|
-from optparse import OptionGroup # pylint: disable=deprecated-module
|
|
import gssapi
|
|
|
|
from ipalib.constants import (
|
|
RENEWAL_CA_NAME, RENEWAL_REUSE_CA_NAME, RENEWAL_SELFSIGNED_CA_NAME,
|
|
IPA_CA_CN)
|
|
from ipalib.install import certmonger, certstore
|
|
-from ipapython import admintool, ipautil
|
|
+from ipapython import admintool, ipautil, config
|
|
from ipapython.certdb import (EMPTY_TRUST_FLAGS,
|
|
EXTERNAL_CA_TRUST_FLAGS,
|
|
TrustFlags,
|
|
@@ -61,7 +60,7 @@ class CACertManage(admintool.AdminTool):
|
|
"-p", "--password", dest='password',
|
|
help="Directory Manager password")
|
|
|
|
- renew_group = OptionGroup(parser, "Renew options")
|
|
+ renew_group = config.OptionGroup(parser, "Renew options")
|
|
renew_group.add_option(
|
|
"--self-signed", dest='self_signed',
|
|
action='store_true',
|
|
@@ -89,7 +88,7 @@ class CACertManage(admintool.AdminTool):
|
|
"certificate chain")
|
|
parser.add_option_group(renew_group)
|
|
|
|
- install_group = OptionGroup(parser, "Install options")
|
|
+ install_group = config.OptionGroup(parser, "Install options")
|
|
install_group.add_option(
|
|
"-n", "--nickname", dest='nickname',
|
|
help="Nickname for the certificate")
|
|
@@ -98,7 +97,7 @@ class CACertManage(admintool.AdminTool):
|
|
help="Trust flags for the certificate in certutil format")
|
|
parser.add_option_group(install_group)
|
|
|
|
- delete_group = OptionGroup(parser, "Delete options")
|
|
+ delete_group = config.OptionGroup(parser, "Delete options")
|
|
delete_group.add_option(
|
|
"-f", "--force", action='store_true',
|
|
help="Force removing the CA even if chain validation fails")
|
|
diff --git a/ipaserver/install/ipa_kra_install.py b/ipaserver/install/ipa_kra_install.py
|
|
index 3e4cd67fa677db2534a639eb6beb14dfd78bf035..8a09179f7fa0c2ddad72d01e9c3eaf98575d0a88 100644
|
|
--- a/ipaserver/install/ipa_kra_install.py
|
|
+++ b/ipaserver/install/ipa_kra_install.py
|
|
@@ -22,13 +22,12 @@ from __future__ import print_function, absolute_import
|
|
import logging
|
|
import sys
|
|
import tempfile
|
|
-from optparse import SUPPRESS_HELP # pylint: disable=deprecated-module
|
|
|
|
from textwrap import dedent
|
|
from ipalib import api
|
|
from ipalib.constants import DOMAIN_LEVEL_1
|
|
from ipaplatform.paths import paths
|
|
-from ipapython import admintool
|
|
+from ipapython import admintool, config
|
|
from ipaserver.install import service
|
|
from ipaserver.install import cainstance
|
|
from ipaserver.install import custodiainstance
|
|
@@ -73,7 +72,7 @@ class KRAInstall(admintool.AdminTool):
|
|
parser.add_option(
|
|
"--uninstall",
|
|
dest="uninstall", action="store_true", default=False,
|
|
- help=SUPPRESS_HELP)
|
|
+ help=config.SUPPRESS_HELP)
|
|
|
|
parser.add_option(
|
|
"--pki-config-override", dest="pki_config_override",
|
|
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
|
|
index 57ad8dd05206132d3458fa84e7fb996b135f7f71..8d75a0e6beba09086bc2ce8c73f3bcfe81e52113 100644
|
|
--- a/ipaserver/install/ipa_restore.py
|
|
+++ b/ipaserver/install/ipa_restore.py
|
|
@@ -20,7 +20,6 @@
|
|
from __future__ import absolute_import, print_function
|
|
|
|
import logging
|
|
-import optparse # pylint: disable=deprecated-module
|
|
import os
|
|
import shutil
|
|
import sys
|
|
@@ -34,7 +33,7 @@ import six
|
|
from ipaclient.install.client import update_ipa_nssdb
|
|
from ipalib import api, errors
|
|
from ipalib.constants import FQDN
|
|
-from ipapython import version, ipautil
|
|
+from ipapython import version, ipautil, config
|
|
from ipapython.ipautil import run, user_input
|
|
from ipapython import admintool, certdb
|
|
from ipapython.dn import DN
|
|
@@ -190,7 +189,7 @@ class Restore(admintool.AdminTool):
|
|
help="Directory Manager password")
|
|
parser.add_option(
|
|
"--gpg-keyring", dest="gpg_keyring",
|
|
- help=optparse.SUPPRESS_HELP)
|
|
+ help=config.SUPPRESS_HELP)
|
|
parser.add_option(
|
|
"--data", dest="data_only", action="store_true",
|
|
default=False, help="Restore only the data")
|
|
diff --git a/ipaserver/install/ipa_server_certinstall.py b/ipaserver/install/ipa_server_certinstall.py
|
|
index e29f00ec37779aeb10255c5df6e10d6ecc0a6d11..e9f680b1d1e505f89fc1611b8dbb3f84768f6781 100644
|
|
--- a/ipaserver/install/ipa_server_certinstall.py
|
|
+++ b/ipaserver/install/ipa_server_certinstall.py
|
|
@@ -22,12 +22,11 @@ from __future__ import print_function, absolute_import
|
|
import os
|
|
import os.path
|
|
import tempfile
|
|
-import optparse # pylint: disable=deprecated-module
|
|
|
|
from ipalib import x509
|
|
from ipalib.install import certmonger
|
|
from ipaplatform.paths import paths
|
|
-from ipapython import admintool, dogtag
|
|
+from ipapython import admintool, dogtag, config
|
|
from ipapython.certdb import NSSDatabase, get_ca_nickname
|
|
from ipapython.dn import DN
|
|
from ipapython import ipaldap
|
|
@@ -65,8 +64,8 @@ class ServerCertInstall(admintool.AdminTool):
|
|
help="The password of the PKCS#12 file")
|
|
parser.add_option(
|
|
"--dirsrv_pin", "--http_pin",
|
|
- dest="pin",
|
|
- help=optparse.SUPPRESS_HELP)
|
|
+ dest="pin", sensitive=True,
|
|
+ help=config.SUPPRESS_HELP)
|
|
parser.add_option(
|
|
"--cert-name",
|
|
dest="cert_name", metavar="NAME",
|
|
diff --git a/ipatests/i18n.py b/ipatests/i18n.py
|
|
index 49f5c4c3232346db3147bd7a5ba8056344ac907f..57915c286be72124fa23380f97f3922496f00c22 100644
|
|
--- a/ipatests/i18n.py
|
|
+++ b/ipatests/i18n.py
|
|
@@ -22,7 +22,6 @@ from __future__ import print_function
|
|
|
|
# WARNING: Do not import ipa modules, this is also used as a
|
|
# stand-alone script (invoked from po Makefile).
|
|
-import optparse # pylint: disable=deprecated-module
|
|
import sys
|
|
import gettext
|
|
import re
|
|
@@ -30,6 +29,7 @@ import os
|
|
import traceback
|
|
import polib
|
|
from collections import namedtuple
|
|
+from ipapython import config
|
|
|
|
import six
|
|
|
|
@@ -722,9 +722,9 @@ usage ='''
|
|
def main():
|
|
global verbose, print_traceback, pedantic, show_strings
|
|
|
|
- parser = optparse.OptionParser(usage=usage)
|
|
+ parser = config.IPAOptionParser(usage=usage)
|
|
|
|
- mode_group = optparse.OptionGroup(parser, 'Operational Mode',
|
|
+ mode_group = config.OptionGroup(parser, 'Operational Mode',
|
|
'You must select one these modes to run in')
|
|
|
|
mode_group.add_option('-g', '--test-gettext', action='store_const', const='test_gettext', dest='mode',
|
|
@@ -748,7 +748,7 @@ def main():
|
|
parser.add_option('--traceback', action='store_true', dest='print_traceback', default=False,
|
|
help='print the traceback when an exception occurs')
|
|
|
|
- param_group = optparse.OptionGroup(parser, 'Run Time Parameters',
|
|
+ param_group = config.OptionGroup(parser, 'Run Time Parameters',
|
|
'These may be used to modify the run time defaults')
|
|
|
|
param_group.add_option('--test-lang', action='store', dest='test_lang', default='test',
|
|
diff --git a/makeapi.in b/makeapi.in
|
|
index a801b9253db9500e0510fe591074ccf2e6d752c1..8fc87d23de743a6d661112ee616dce129a785a36 100644
|
|
--- a/makeapi.in
|
|
+++ b/makeapi.in
|
|
@@ -38,6 +38,7 @@ from ipalib.parameters import Param
|
|
from ipalib.output import Output
|
|
from ipalib.text import Gettext, NGettext, ConcatenatedLazyText
|
|
from ipalib.capabilities import capabilities
|
|
+from ipapython import config
|
|
|
|
API_FILE='API.txt'
|
|
|
|
@@ -84,9 +85,7 @@ OUTPUT_IGNORED_ATTRIBUTES = (
|
|
)
|
|
|
|
def parse_options():
|
|
- from optparse import OptionParser # pylint: disable=deprecated-module
|
|
-
|
|
- parser = OptionParser()
|
|
+ parser = config.IPAOptionParser()
|
|
parser.add_option("--validate", dest="validate", action="store_true",
|
|
default=False, help="Validate the API vs the stored API")
|
|
|
|
--
|
|
2.47.1
|
|
|