[Freeipa-devel] [PATCH] Make enabling the autofs service more robust
Jakub Hrozek
jhrozek at redhat.com
Fri Nov 9 15:06:29 UTC 2012
On Tue, Nov 06, 2012 at 08:57:06AM +0100, Jan Cholasta wrote:
> On 29.10.2012 17:21, Jakub Hrozek wrote:
> >An improvement based on Honza's suggestion.
> >
>
> You might want to remove the try block around
> "sssdconfig.activate_service('autofs')". If it throws NoServiceError
> at this point, there is something really broken in SSSDConfig, in
> which case it is better to display a traceback rather than a nice
> error message IMO.
>
In retrospective, I agree. We can't try-except every line.
-------------- next part --------------
>From 77869a71f758265f45d69bbebf158b0cf10e9079 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Mon, 29 Oct 2012 10:06:45 +0100
Subject: [PATCH] Make enabling the autofs service more robust
---
ipa-client/ipa-install/ipa-client-automount | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/ipa-client/ipa-install/ipa-client-automount b/ipa-client/ipa-install/ipa-client-automount
index 182f9f659dc3bfca198fc254f1a51047b3d9d31f..10512a72a278bc61ec1081f4c7d26bd4111deb31 100755
--- a/ipa-client/ipa-install/ipa-client-automount
+++ b/ipa-client/ipa-install/ipa-client-automount
@@ -154,14 +154,18 @@ def configure_autofs_sssd(fstore, statestore, autodiscover, options):
except Exception, e:
sys.exit(e)
- if 'autofs' not in sssdconfig.list_services():
+ try:
sssdconfig.new_service('autofs')
+ except SSSDConfig.ServiceAlreadyExists:
+ pass
+ except SSSDConfig.ServiceNotRecognizedError:
+ root_logger.error("Unable to activate the Autofs service in SSSD config.")
+ root_logger.info(
+ "Please make sure you have SSSD built with autofs support installed.")
+ root_logger.info(
+ "Configure autofs support manually in /etc/sssd/sssd.conf.")
- try:
- sssdconfig.activate_service('autofs')
- except SSSDConfig.NoServiceError:
- print "Unable to activate the autofs service in SSSD config."
- root_logger.debug("Unable to activate the autofs service in SSSD config.")
+ sssdconfig.activate_service('autofs')
domain = None
for name in domains:
--
1.7.12.1
More information about the Freeipa-devel
mailing list