No try: needed for pop/importlib/getattr

This commit is contained in:
Nico Schottelius 2020-01-10 11:35:04 +01:00
parent b7596e071a
commit d9dd6b48dc

View file

@ -73,10 +73,14 @@ if __name__ == '__main__':
arguments = vars(args) arguments = vars(args)
print(arguments) print(arguments)
print(etcd_parser) print(etcd_parser)
try:
name = arguments.pop('command') name = arguments.pop('command')
mod = importlib.import_module('uncloud.{}.main'.format(name)) mod = importlib.import_module('uncloud.{}.main'.format(name))
main = getattr(mod, 'main') main = getattr(mod, 'main')
if component in ETCD_COMPONENTS:
import etcd3
try:
main(arguments) main(arguments)
except UncloudException as err: except UncloudException as err:
logger.error(err) logger.error(err)