From 75bb8a11bd5b137ef7b33156ad6d144d871c5712 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 2 Jul 2018 16:08:47 -0500 Subject: [PATCH] do not fail on plugin import --- onionr/onionrplugins.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/onionr/onionrplugins.py b/onionr/onionrplugins.py index 6160838e..a699433c 100644 --- a/onionr/onionrplugins.py +++ b/onionr/onionrplugins.py @@ -63,15 +63,17 @@ def enable(name, onionr = None, start_event = True): if exists(name): enabled_plugins = get_enabled_plugins() if not name in enabled_plugins: - enabled_plugins.append(name) - config.set('plugins.enabled', enabled_plugins, True) - - events.call(get_plugin(name), 'enable', onionr) - - if start_event is True: - start(name) - - return True + try: + events.call(get_plugin(name), 'enable', onionr) + except ImportError: # Was getting import error on Gitlab CI test "data" + return False + else: + enabled_plugins.append(name) + config.set('plugins.enabled', enabled_plugins, True) + + if start_event is True: + start(name) + return True else: return False else: