0

According to the directions of Openstack Official Heat/Plugins wiki https://wiki.openstack.org/wiki/Heat/Plugins, we only need "To install a plugin, copy the Python modules to one of the configured plugin directories. Note that heat-engine must be restarted after this in order to load the new plugins.". But I hit the following error messages after I restart heat-engine..

[root@cs14 heat]# heat-engine
2015-05-04 06:02:09.774 20839 WARNING heat.common.config [-] HT-A65A0DF The "instance_user" option in heat.conf is deprecated and will be removed in the Juno release.
[05/04/2015 06:02:10 EDT]heatCRITICAL : ImportError: No module named my_heat_plugin.client
Traceback (most recent call last):
  File "/usr/bin/heat-engine", line 67, in <module>
    srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
  File "/usr/lib/python2.6/site-packages/heat/engine/service.py", line 288, in __init__
    resources.initialise()
  File "/usr/lib/python2.6/site-packages/heat/engine/resources/__init__.py", line 44, in initialise
    _load_global_environment(global_env)
  File "/usr/lib/python2.6/site-packages/heat/engine/resources/__init__.py", line 49, in _load_global_environment
    _load_global_resources(env)
  File "/usr/lib/python2.6/site-packages/heat/engine/resources/__init__.py", line 54, in _load_global_resources
    manager = plugin_manager.PluginManager(__name__)
  File "/usr/lib/python2.6/site-packages/heat/engine/plugin_manager.py", line 58, in __init__
    self.modules = list(modules())
  File "/usr/lib/python2.6/site-packages/heat/common/plugin_loader.py", line 91, in load_modules
    module = _import_module(importer, module_name, package)
  File "/usr/lib/python2.6/site-packages/heat/common/plugin_loader.py", line 72, in _import_module
    module = loader.load_module(module_name)
  File "/usr/lib64/python2.6/pkgutil.py", line 238, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/usr/lib/heat/abc_heat_plugin/resources/abc/abc_server.py", line 24, in <module>
    from abc_heat_plugin.client import constants as const
ImportError: No module named abc_heat_plugin.client

To solve this problem, I've figured out two ways which are workable. Method 1. copy abc_heat_plugin to /usr/lib/python2.6/site-packages and restart heat-engine Method 2. use .pth file. 1) Create a file /usr/lib/python2.6/site-packages/.pth with the following three lines (no need to do this if it exists)

/usr/lib/heat
/usr/lib/heat/abc_heat_plugin
/usr/lib/heat/abc_heat_plugin/client

2) copy plugin "my_heat_plugin" to /usr/lib/heat

3) restart heat service

BUT both ways have to do more than the official guide, so I wonder whether I missed anything important. Any suggestions? Thanks. (BTW, my_heat_plugin is working well.)

zzxwill
  • 536
  • 2
  • 6
  • 16

1 Answers1

0

I think the basic idea is that you drop the resource in /usr/lib/heat, but any modules or packages that are used by the resource must be installed the usual way. You sort of did that manually by moving the files to site-packages.

Take a look at any of the plugins in heat/contrib for example. There are a few that have dependencies such as clients to other OpenStack services, and in all cases the assumption is made that those clients were installed separately.

So if you can, just create a setup.py for your client package, and install that separately from the heat plugin.

Miguel Grinberg
  • 65,299
  • 14
  • 133
  • 152