Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bubble up import errors from loading the actual plugins #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ requests
humanfriendly
party
pluginbase
django
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add this to get the tox lint to pass

6 changes: 5 additions & 1 deletion src/lavatory/utils/setup_pluginbase.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import os
import pathlib
import re

from pluginbase import PluginBase

Expand Down Expand Up @@ -51,7 +52,10 @@ def get_policy(plugin_source, repository, default=True):
policy_name = repository.replace("-", "_")
try:
policy = plugin_source.load_plugin(policy_name)
except ImportError:
except ImportError as err:
# bubble up import errors from the actual loading of existing plugins
if not re.match(r'^No module named \'pluginbase\..+\.%s\'$' % policy_name, str(err)):
raise err
if default:
LOG.info("No policy found for %s. Applying Default", repository)
policy = plugin_source.load_plugin('default')
Expand Down