On 15/10/13 02:18, Sam Alba wrote:
Hello,

I am working on a Heat plugin that makes a new resource available in a
template. It's working great and I will opensource it this week if I
can get the packaging right...

Awesome! :)

Right now, I am linking my module.py file in /usr/lib/heat to get it
loaded when heat-engine starts. But according to the doc, I am
supposed to be able to make the plugin discoverable by heat-engine if
the module appears in the package "heat.engine.plugins"[1]

I think the documentation may be leading you astray here; it's the other way around: once the plugin is discovered by the engine, it will appear in the package heat.engine.plugins. So you should be able to do:

>>> import heat.engine.resources
>>> heat.engine.resources.initialise()
>>> from heat.engine.plugins import module
>>> print module.resource_mapping()

(FWIW this is working for me on latest master of Heat.)

As far as making the plugin discoverable is concerned, all you should have to do is install the module in /usr/lib/heat/.

I looked into the plugin_loader module in the Heat source code and it
looks like it should work. However I was unable to get a proper Python
package.

Has anyone been able to make this packaging right for an external Heat plugin?

I've never tried to do this with a Python package, the mechanism is really designed more for either dropping the module in there manually, or installing it from a Debian or RPM package.

It sounds like what you're doing is trying to install the package in /usr/lib/python2.7/site-packages/ (or in a venv) in the package heat.engine.plugins and get the engine to recognise it that way? I don't think there's a safe way to make that work, because the plugin loader creates its own heat.engine.plugins package that will replace anything that exists on that path (see line 41 of plugin_loader.py).

Heat (in fact, all of OpenStack) is designed as a system service, so the normal rules of Python _application_ packaging don't quite fit. e.g. If you want to use a plugin locally (for a single user) rather than install it globally, the way to do it is to specify a local plugin directory when running heat-engine, rather than have the plugin installed in a venv.

Hope that helps.

cheers,
Zane.

_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to