Import Error when using simple crypto plugin

Bug #1602936 reported by Fernando Diaz
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Barbican
Fix Released
Undecided
Marc Koderer

Bug Description

When Barbican is setup following http://docs.openstack.org/developer/barbican/setup/dev.html when trying to create a secret the following error is given:

2016-07-12 17:18:47.425 ERROR stevedore.extension [req-eefebad5-6972-4187-b003-1ec
91a1459cf None 12345] Could not load 'simple_crypto': No module named PublicKey
2016-07-12 17:18:47.426 ERROR stevedore.extension [req-eefebad5-6972-4187-b003-1ec
91a1459cf None 12345] No module named PublicKey
2016-07-12 17:18:47.426 TRACE stevedore.extension Traceback (most recent call last
):
2016-07-12 17:18:47.426 TRACE stevedore.extension File "/usr/local/lib/python2.7
/dist-packages/stevedore/extension.py", line 163, in _load_plugins
2016-07-12 17:18:47.426 TRACE stevedore.extension verify_requirements,
2016-07-12 17:18:47.426 TRACE stevedore.extension File "/usr/local/lib/python2.7
/dist-packages/stevedore/named.py", line 123, in _load_one_plugin
2016-07-12 17:18:47.426 TRACE stevedore.extension verify_requirements,
2016-07-12 17:18:47.426 TRACE stevedore.extension File "/usr/local/lib/python2.7
/dist-packages/stevedore/extension.py", line 184, in _load_one_plugin
2016-07-12 17:18:47.426 TRACE stevedore.extension plugin = ep.resolve()
2016-07-12 17:18:47.426 TRACE stevedore.extension File "/usr/local/lib/python2.7
/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
2016-07-12 17:18:47.426 TRACE stevedore.extension module = __import__(self.module_name, fromlist=['__name__'], level=0)
2016-07-12 17:18:47.426 TRACE stevedore.extension File "/opt/stack/barbican/barbican/plugin/crypto/simple_crypto.py", line 15, in <module>
2016-07-12 17:18:47.426 TRACE stevedore.extension from Crypto.PublicKey import DSA
2016-07-12 17:18:47.426 TRACE stevedore.extension ImportError: No module named PublicKey
2016-07-12 17:18:47.426 TRACE stevedore.extension
2016-07-12 17:18:47.428 ERROR barbican.api.controllers [req-eefebad5-6972-4187-b003-1ec91a1459cf None 12345] Secret creation failure seen - please contact site administrator.
2016-07-12 17:18:47.428 TRACE barbican.api.controllers Traceback (most recent call last):
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/api/controllers/__init__.py", line 103, in handler
2016-07-12 17:18:47.428 TRACE barbican.api.controllers return fn(inst, *args, **kwargs)
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/api/controllers/__init__.py", line 89, in enforcer
2016-07-12 17:18:47.428 TRACE barbican.api.controllers return fn(inst, *args, **kwargs)
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/api/controllers/__init__.py", line 155, in content_types_enforcer
2016-07-12 17:18:47.428 TRACE barbican.api.controllers return fn(inst, *args, **kwargs)
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/api/controllers/secrets.py", line 362, in on_post
2016-07-12 17:18:47.428 TRACE barbican.api.controllers transport_key_id=data.get('transport_key_id'))2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/plugin/resources.py", line 106, in store_secret
2016-07-12 17:18:47.428 TRACE barbican.api.controllers secret_model, project_model)
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/plugin/resources.py", line 274, in _store_secret_using_plugin
2016-07-12 17:18:47.428 TRACE barbican.api.controllers secret_metadata = store_plugin.store_secret(secret_dto, context)
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/plugin/store_crypto.py", line 77, in store_secret
2016-07-12 17:18:47.428 TRACE barbican.api.controllers crypto.PluginSupportTypes.ENCRYPT_DECRYPT
2016-07-12 17:18:47.428 TRACE barbican.api.controllers File "/opt/stack/barbican/barbican/plugin/crypto/manager.py", line 82, in get_plugin_store_generate
2016-07-12 17:18:47.428 TRACE barbican.api.controllers raise crypto.CryptoPluginNotFound()
2016-07-12 17:18:47.428 TRACE barbican.api.controllers CryptoPluginNotFound: Crypto plugin not found.
2016-07-12 17:18:47.428 TRACE barbican.api.controllers
2016-07-12 17:18:47.438 INFO barbican.api.middleware.context [req-eefebad5-6972-4187-b003-1ec91a1459cf None 12345] Processed request: 500 Internal Server Error - POST http://localhost:9311/v1/secrets

Main Cause: Could not load 'simple_crypto': No module named PublicKey

Simple Crypto Plugin has the following Crypto imports:
from Crypto.PublicKey import DSA
from Crypto.PublicKey import RSA
from Crypto.Util import asn1

they import properly by running them in python.
pycrypto is installed in virtualenv, Command was run in virtualenv.

Marc Koderer (m-koderer)
Changed in barbican:
status: New → Confirmed
assignee: nobody → Marc Koderer (m-koderer)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to barbican (master)

Fix proposed to branch: master
Review: https://review.openstack.org/385332

Changed in barbican:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to barbican (master)

Reviewed: https://review.openstack.org/385332
Committed: https://git.openstack.org/cgit/openstack/barbican/commit/?id=282ad4b7aa1fa55fa311a389427054bbd4856ca5
Submitter: Jenkins
Branch: master

commit 282ad4b7aa1fa55fa311a389427054bbd4856ca5
Author: Marc Koderer <email address hidden>
Date: Wed Oct 12 10:05:56 2016 +0200

    Rename crypto.py to base.py

    On case non-case sensitive file systems (used in OSX or
    Windows) the import of "Crypto" leads to an import of
    the local crypto.py. This leads to very strange errors
    during unit test runs.

    Change-Id: I03e61789a9eb98036600ecf6f86f0dad2eb7621c
    Closes-bug: #1602936

Changed in barbican:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/barbican 4.0.0.0b2

This issue was fixed in the openstack/barbican 4.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.