Better error handling, Efforts to run non-root with occasional sudo

This commit is contained in:
ahmadbilalkhalid 2019-12-29 23:14:39 +05:00
commit f980cdb464
7 changed files with 90 additions and 47 deletions

View file

@ -47,8 +47,15 @@ class Settings(object):
}
except configparser.Error as err:
raise configparser.Error('{} in config file {}'.format(err.message, self.config_file)) from err
return Etcd3Wrapper(*args, **kwargs)
else:
try:
wrapper = Etcd3Wrapper(*args, **kwargs)
except Exception as err:
logger.error('etcd connection not successfull. Please check your config file.'
'\nDetails: %s\netcd connection parameters: %s', err, kwargs)
sys.exit(1)
else:
return wrapper
def read_internal_values(self):
self.config_parser.read_dict({