summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2015-04-09 19:20:03 -0400
committerPatrick Uiterwijk <puiterwijk@redhat.com>2015-04-13 18:30:37 +0200
commitf73332fb7d55bd5753a8bafc2493172203fcf377 (patch)
treec6eeb53e1b16519bbd01d9b041b406259826ab16
parentc4c121e57516ffb70b980ea1fbafe1e6f8611c3f (diff)
downloadipsilon-f73332fb7d55bd5753a8bafc2493172203fcf377.zip
ipsilon-f73332fb7d55bd5753a8bafc2493172203fcf377.tar.gz
ipsilon-f73332fb7d55bd5753a8bafc2493172203fcf377.tar.xz
Better error handling for login mgrs in server install/uninstall
The purpose is to catch it when either no modules are enabled or if you try to set the login module order and one of them is not available/installed, then fail gracefully. There were some baked-in assumptions that all login providers are installed. Add some error handling around trying to determine what is available, and rather than trying to force pam to be enabled just exit with a handy message. Don't rely on lm_order during uninstall. Use the list of enabled Login managers instead. Bail out of argument checking if uninstall is requested. https://fedorahosted.org/ipsilon/ticket/105 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
-rwxr-xr-xipsilon/install/ipsilon-server-install17
1 files changed, 9 insertions, 8 deletions
diff --git a/ipsilon/install/ipsilon-server-install b/ipsilon/install/ipsilon-server-install
index 5ab163b..502d4eb 100755
--- a/ipsilon/install/ipsilon-server-install
+++ b/ipsilon/install/ipsilon-server-install
@@ -182,7 +182,10 @@ def install(plugins, args):
logger.info('Configuring login managers')
for plugin_name in args['lm_order']:
- plugin = plugins['Login Managers'][plugin_name]
+ try:
+ plugin = plugins['Login Managers'][plugin_name]
+ except KeyError:
+ sys.exit('Login provider %s not installed' % plugin_name)
if plugin.configure(args) == False:
print 'Configuration of login manager %s failed' % plugin_name
@@ -235,7 +238,7 @@ def uninstall(plugins, args):
print 'Removal of environment helper %s failed' % plugin_name
logger.info('Removing login managers')
- for plugin_name in args['lm_order']:
+ for plugin_name in plugins['Login Managers']:
plugin = plugins['Login Managers'][plugin_name]
if plugin.unconfigure(args) == False:
print 'Removal of login manager %s failed' % plugin_name
@@ -351,6 +354,9 @@ def parse_args(plugins):
if not args['hostname']:
args['hostname'] = socket.getfqdn()
+ if args['uninstall']:
+ return args
+
if len(args['hostname'].split('.')) < 2:
raise ConfigurationError('Hostname: %s is not a FQDN')
@@ -373,12 +379,7 @@ def parse_args(plugins):
args['lm_order'] = args['lm_order'].split(',')
if len(args['lm_order']) == 0:
- #force the basic pam provider if nothing else is selected
- if 'pam' not in args:
- parser.print_help()
- sys.exit(-1)
- args['lm_order'] = ['pam']
- args['pam'] = 'yes'
+ sys.exit('No login plugins are enabled.')
#FIXME: check instance is only alphanums