From ea6d627c9851f07b3c35348175bde2a3eabb8c37 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 21 Oct 2015 11:30:47 -0400 Subject: [PATCH] Don't assume cache_dir is set in conf during uninstall The code was unconditionally retrieving a value from ipsilon.conf and replacing strings in it. This would fail if the config file didn't exist, there was no global section or if cache_dir wasn't there. https://fedorahosted.org/ipsilon/ticket/186 Signed-off-by: Rob Crittenden Reviewed-by: Patrick Uiterwijk --- ipsilon/install/ipsilon-server-install | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ipsilon/install/ipsilon-server-install b/ipsilon/install/ipsilon-server-install index bf086f9..7837527 100755 --- a/ipsilon/install/ipsilon-server-install +++ b/ipsilon/install/ipsilon-server-install @@ -243,9 +243,14 @@ def uninstall(plugins, args): 'ipsilon-%s.conf' % args['instance']) data_dir = os.path.join(DATADIR, args['instance']) - tconf = ConfigParser.SafeConfigParser() - tconf.read(os.path.join(instance_conf, 'ipsilon.conf')) - cache_dir = tconf.get('global', 'cache_dir').replace('"', '') + try: + tconf = ConfigParser.SafeConfigParser() + tconf.read(os.path.join(instance_conf, 'ipsilon.conf')) + cache_dir = tconf.get('global', 'cache_dir') + except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): + cache_dir = None + else: + cache_dir = cache_dir.replace('"', '') if not os.path.exists(instance_conf): raise Exception('Could not find instance %s configuration' -- 2.20.1