|
|
95ea96 |
From 040df002df8c58c84a94d2fb3dec717beb6e5f0a Mon Sep 17 00:00:00 2001
|
|
|
95ea96 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
95ea96 |
Date: Wed, 22 Aug 2018 18:29:07 +0200
|
|
|
95ea96 |
Subject: [PATCH] ipa commands: print 'IPA is not configured' when ipa is not
|
|
|
95ea96 |
setup
|
|
|
95ea96 |
|
|
|
95ea96 |
Some commands print tracebacks or unclear error message when
|
|
|
95ea96 |
they are called on a machine where ipa packages are installed but
|
|
|
95ea96 |
IPA is not configured.
|
|
|
95ea96 |
Consistently report 'IPA is not configured on this system' in this
|
|
|
95ea96 |
case.
|
|
|
95ea96 |
|
|
|
95ea96 |
Related to https://pagure.io/freeipa/issue/6261
|
|
|
95ea96 |
|
|
|
95ea96 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
95ea96 |
---
|
|
|
95ea96 |
install/tools/ipa-compat-manage | 2 ++
|
|
|
95ea96 |
install/tools/ipa-csreplica-manage | 4 +++-
|
|
|
95ea96 |
ipaserver/advise/base.py | 2 ++
|
|
|
95ea96 |
ipaserver/install/ipa_pkinit_manage.py | 2 ++
|
|
|
95ea96 |
ipaserver/install/ipa_server_upgrade.py | 2 ++
|
|
|
95ea96 |
ipaserver/install/ipa_winsync_migrate.py | 2 +-
|
|
|
95ea96 |
6 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
95ea96 |
|
|
|
95ea96 |
diff --git a/install/tools/ipa-compat-manage b/install/tools/ipa-compat-manage
|
|
|
95ea96 |
index 6dd259d2aad870e575093d6732157de743502ac2..ce61b702689448dcfbddbf0dad6c2adde861e6e9 100755
|
|
|
95ea96 |
--- a/install/tools/ipa-compat-manage
|
|
|
95ea96 |
+++ b/install/tools/ipa-compat-manage
|
|
|
95ea96 |
@@ -82,6 +82,8 @@ def main():
|
|
|
95ea96 |
retval = 0
|
|
|
95ea96 |
files = [paths.SCHEMA_COMPAT_ULDIF]
|
|
|
95ea96 |
|
|
|
95ea96 |
+ installutils.check_server_configuration()
|
|
|
95ea96 |
+
|
|
|
95ea96 |
options, args = parse_options()
|
|
|
95ea96 |
|
|
|
95ea96 |
if len(args) != 1:
|
|
|
95ea96 |
diff --git a/install/tools/ipa-csreplica-manage b/install/tools/ipa-csreplica-manage
|
|
|
95ea96 |
index 87f034d1205938c4551f939b0e8c0da292e90bc1..c7b62b293d68c95912ab641294180eeb74a98573 100755
|
|
|
95ea96 |
--- a/install/tools/ipa-csreplica-manage
|
|
|
95ea96 |
+++ b/install/tools/ipa-csreplica-manage
|
|
|
95ea96 |
@@ -32,6 +32,7 @@ from ipaserver.install import (replication, installutils, bindinstance,
|
|
|
95ea96 |
from ipalib import api, errors
|
|
|
95ea96 |
from ipalib.util import has_managed_topology
|
|
|
95ea96 |
from ipapython import ipautil, ipaldap, version
|
|
|
95ea96 |
+from ipapython.admintool import ScriptError
|
|
|
95ea96 |
from ipapython.dn import DN
|
|
|
95ea96 |
|
|
|
95ea96 |
logger = logging.getLogger(os.path.basename(__file__))
|
|
|
95ea96 |
@@ -408,6 +409,7 @@ def exit_on_managed_topology(what, hint="topologysegment"):
|
|
|
95ea96 |
|
|
|
95ea96 |
|
|
|
95ea96 |
def main():
|
|
|
95ea96 |
+ installutils.check_server_configuration()
|
|
|
95ea96 |
options, args = parse_options()
|
|
|
95ea96 |
|
|
|
95ea96 |
# Just initialize the environment. This is so the installer can have
|
|
|
95ea96 |
@@ -496,7 +498,7 @@ try:
|
|
|
95ea96 |
main()
|
|
|
95ea96 |
except KeyboardInterrupt:
|
|
|
95ea96 |
sys.exit(1)
|
|
|
95ea96 |
-except SystemExit as e:
|
|
|
95ea96 |
+except (SystemExit, ScriptError) as e:
|
|
|
95ea96 |
sys.exit(e)
|
|
|
95ea96 |
except Exception as e:
|
|
|
95ea96 |
sys.exit("unexpected error: %s" % e)
|
|
|
95ea96 |
diff --git a/ipaserver/advise/base.py b/ipaserver/advise/base.py
|
|
|
95ea96 |
index 40f2e65dc8f74a833ef6fe107eabf96ac6a3c12b..07b1431e84c31cb7ba2ecc58a9d152e596dd8b00 100644
|
|
|
95ea96 |
--- a/ipaserver/advise/base.py
|
|
|
95ea96 |
+++ b/ipaserver/advise/base.py
|
|
|
95ea96 |
@@ -30,6 +30,7 @@ from ipalib.errors import ValidationError
|
|
|
95ea96 |
from ipaplatform.paths import paths
|
|
|
95ea96 |
from ipapython import admintool
|
|
|
95ea96 |
from ipapython.ipa_log_manager import Filter
|
|
|
95ea96 |
+from ipaserver.install import installutils
|
|
|
95ea96 |
|
|
|
95ea96 |
|
|
|
95ea96 |
"""
|
|
|
95ea96 |
@@ -418,6 +419,7 @@ class IpaAdvise(admintool.AdminTool):
|
|
|
95ea96 |
|
|
|
95ea96 |
def validate_options(self):
|
|
|
95ea96 |
super(IpaAdvise, self).validate_options(needs_root=False)
|
|
|
95ea96 |
+ installutils.check_server_configuration()
|
|
|
95ea96 |
|
|
|
95ea96 |
if len(self.args) > 1:
|
|
|
95ea96 |
raise self.option_parser.error("You can only provide one "
|
|
|
95ea96 |
diff --git a/ipaserver/install/ipa_pkinit_manage.py b/ipaserver/install/ipa_pkinit_manage.py
|
|
|
95ea96 |
index c54bb14f58b9bfd19ae860270a1c1955b4de1732..4a79bba5d1b636827a7a031965b49cf7b34c6330 100644
|
|
|
95ea96 |
--- a/ipaserver/install/ipa_pkinit_manage.py
|
|
|
95ea96 |
+++ b/ipaserver/install/ipa_pkinit_manage.py
|
|
|
95ea96 |
@@ -9,6 +9,7 @@ import logging
|
|
|
95ea96 |
from ipalib import api
|
|
|
95ea96 |
from ipaplatform.paths import paths
|
|
|
95ea96 |
from ipapython.admintool import AdminTool
|
|
|
95ea96 |
+from ipaserver.install import installutils
|
|
|
95ea96 |
from ipaserver.install.krbinstance import KrbInstance, is_pkinit_enabled
|
|
|
95ea96 |
|
|
|
95ea96 |
logger = logging.getLogger(__name__)
|
|
|
95ea96 |
@@ -21,6 +22,7 @@ class PKINITManage(AdminTool):
|
|
|
95ea96 |
|
|
|
95ea96 |
def validate_options(self):
|
|
|
95ea96 |
super(PKINITManage, self).validate_options(needs_root=True)
|
|
|
95ea96 |
+ installutils.check_server_configuration()
|
|
|
95ea96 |
|
|
|
95ea96 |
option_parser = self.option_parser
|
|
|
95ea96 |
|
|
|
95ea96 |
diff --git a/ipaserver/install/ipa_server_upgrade.py b/ipaserver/install/ipa_server_upgrade.py
|
|
|
95ea96 |
index 1e52bca9765671c0b63bf08b0ad47d40477037ee..7643b97f22fbf6c6861317a171c6e2da377365cd 100644
|
|
|
95ea96 |
--- a/ipaserver/install/ipa_server_upgrade.py
|
|
|
95ea96 |
+++ b/ipaserver/install/ipa_server_upgrade.py
|
|
|
95ea96 |
@@ -35,6 +35,8 @@ class ServerUpgrade(admintool.AdminTool):
|
|
|
95ea96 |
def validate_options(self):
|
|
|
95ea96 |
super(ServerUpgrade, self).validate_options(needs_root=True)
|
|
|
95ea96 |
|
|
|
95ea96 |
+ installutils.check_server_configuration()
|
|
|
95ea96 |
+
|
|
|
95ea96 |
if self.options.force:
|
|
|
95ea96 |
self.options.skip_version_check = True
|
|
|
95ea96 |
|
|
|
95ea96 |
diff --git a/ipaserver/install/ipa_winsync_migrate.py b/ipaserver/install/ipa_winsync_migrate.py
|
|
|
95ea96 |
index 0399b9b7b683cd92692094b53208dcc0f40fd392..43330ad502e736816a1af8e8c2a444e1eae05baa 100644
|
|
|
95ea96 |
--- a/ipaserver/install/ipa_winsync_migrate.py
|
|
|
95ea96 |
+++ b/ipaserver/install/ipa_winsync_migrate.py
|
|
|
95ea96 |
@@ -350,7 +350,7 @@ class WinsyncMigrate(admintool.AdminTool):
|
|
|
95ea96 |
# Check if the IPA server is configured before attempting to migrate
|
|
|
95ea96 |
try:
|
|
|
95ea96 |
installutils.check_server_configuration()
|
|
|
95ea96 |
- except RuntimeError as e:
|
|
|
95ea96 |
+ except admintool.ScriptError as e:
|
|
|
95ea96 |
sys.exit(e)
|
|
|
95ea96 |
|
|
|
95ea96 |
# Finalize API
|
|
|
95ea96 |
--
|
|
|
95ea96 |
2.17.1
|
|
|
95ea96 |
|