heat engine plugins require their test dependencies to be installed to load

Bug #1292655 reported by Cody A.W. Somerville
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Chmouel Boudjnah

Bug Description

The heat engine plugin manager attempts to recurisvely load all modules in a plugin. If a plugin has tests, the plugin manager will try to load them and if the test dependencies aren't installed then heat-engine will fail to start. It should be possible to load a plugin without requiring test dependencies to be installed.

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Maybe the plugin loader should blacklist any packaging called "tests"

Changed in heat:
status: New → Triaged
importance: Undecided → Medium
Changed in heat:
assignee: nobody → Chmouel Boudjnah (chmouel)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: Triaged → In Progress
Revision history for this message
Tomas Sedovic (tsedovic) wrote :

I'm not fond of blacklisting hardcoded parts of the module path.

How about we modify the importer to look at package's `__all__` variable and ignore anything that isn't listed there? If __all__ is missing, we'd revert to the current behaviour.

For example with this plugin structure:

myplugin/
                  __init__.py
                  foo.py
                  bar.py
                  tests/
                            __init__.py
                            test_foo.py
                            test_bar.py

if myplugin/__init__.py contained this:

    __all__ = ['foo', 'bar']

Heat would load the `myplugin.foo` and `myplugin.bar` modules, ignoring everything else. If there were no `__all__` variable, we would load everything just as we do today.

This puts the control of what should and shouldn't be loaded to the plugin authors (who should know this best). And it uses a Python feature the package authors are already familiar with.

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: [Bug 1292655] Re: heat engine plugins require their test dependencies to be installed to load

+1

Excerpts from Tomas Sedovic's message of 2014-04-01 12:54:05 UTC:
> I'm not fond of blacklisting hardcoded parts of the module path.
>
> How about we modify the importer to look at package's `__all__` variable
> and ignore anything that isn't listed there? If __all__ is missing, we'd
> revert to the current behaviour.
>
> For example with this plugin structure:
>
> myplugin/
> __init__.py
> foo.py
> bar.py
> tests/
> __init__.py
> test_foo.py
> test_bar.py
>
>
> if myplugin/__init__.py contained this:
>
> __all__ = ['foo', 'bar']
>
> Heat would load the `myplugin.foo` and `myplugin.bar` modules, ignoring
> everything else. If there were no `__all__` variable, we would load
> everything just as we do today.
>
> This puts the control of what should and shouldn't be loaded to the
> plugin authors (who should know this best). And it uses a Python feature
> the package authors are already familiar with.
>
> --
> You received this bug notification because you are subscribed to heat.
> https://bugs.launchpad.net/bugs/1292655
>
> Title:
> heat engine plugins require their test dependencies to be installed to
> load
>
> Status in Orchestration API (Heat):
> In Progress
>
> Bug description:
> The heat engine plugin manager attempts to recurisvely load all
> modules in a plugin. If a plugin has tests, the plugin manager will
> try to load them and if the test dependencies aren't installed then
> heat-engine will fail to start. It should be possible to load a plugin
> without requiring test dependencies to be installed.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/heat/+bug/1292655/+subscriptions

Changed in heat:
milestone: none → juno-1
tags: added: icehouse-rc-potential
tags: removed: icehouse-rc-potential
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/84117
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=8c73c49dfe07fe002d06ad7ba10b49eeb48ef547
Submitter: Jenkins
Branch: master

commit 8c73c49dfe07fe002d06ad7ba10b49eeb48ef547
Author: Chmouel Boudjnah <email address hidden>
Date: Mon Mar 31 14:05:27 2014 +0200

    Skip tests when loading plugins

    All python files in plugins were automatically loaded which would
    add the dependencies of the tests to the plugins.

    Let skip the files in the .tests. namespace

    Closes-Bug: #1292655
    Change-Id: I25eac87559b5852e9645fbb84c8b4d07b4c1ff42

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-1 → 2014.2
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.