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)
print(arguments)
print(etcd_parser)
try:
name = arguments.pop('command')
mod = importlib.import_module('uncloud.{}.main'.format(name))
main = getattr(mod, 'main')
if component in ETCD_COMPONENTS:
import etcd3
try:
main(arguments)
except UncloudException as err:
logger.error(err)