Make enabling the autofs service more robust

This commit is contained in:
Jakub Hrozek 2012-10-29 10:06:45 +01:00 committed by Martin Kosek
parent 1bf537db9e
commit 33fb949826

View File

@ -154,14 +154,19 @@ def configure_autofs_sssd(fstore, statestore, autodiscover, options):
except Exception, e: except Exception, e:
sys.exit(e) sys.exit(e)
if 'autofs' not in sssdconfig.list_services():
sssdconfig.new_service('autofs')
try: try:
sssdconfig.activate_service('autofs') sssdconfig.new_service('autofs')
except SSSDConfig.NoServiceError: except SSSDConfig.ServiceAlreadyExists:
print "Unable to activate the autofs service in SSSD config." pass
root_logger.debug("Unable to activate the autofs service in SSSD config.") 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.")
sys.exit("Cannot create the autofs service in sssd.conf")
sssdconfig.activate_service('autofs')
domain = None domain = None
for name in domains: for name in domains: