=== added directory 'doc/examples'
=== added directory 'doc/examples/plugins'
=== added directory 'doc/examples/plugins/demo-action-plugin'
=== added file 'doc/examples/plugins/demo-action-plugin/README'
@@ -0,0 +1,4 @@
+This is a simple example of how to write a plugin action for LAVA
+Dispatcher. You will need to install both lava-dispatcher and
+demo-action-plugin for it to work. The json file provided here will run
+the action and exit.
=== added file 'doc/examples/plugins/demo-action-plugin/demo-action-plugin.json'
@@ -0,0 +1,10 @@
+{
+ "job_name": "foo",
+ "target": "panda01",
+ "timeout": 18000,
+ "actions": [
+ {
+ "command": "foo"
+ }
+ ]
+}
=== added directory 'doc/examples/plugins/demo-action-plugin/demo_action_plugin'
=== added file 'doc/examples/plugins/demo-action-plugin/demo_action_plugin/__init__.py'
=== added file 'doc/examples/plugins/demo-action-plugin/demo_action_plugin/foo.py'
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+# Copyright (C) 2011 Linaro Limited
+#
+# Author: Paul Larson <paul.larson@linaro.org>
+#
+# This file is part of LAVA Dispatcher.
+#
+# LAVA Dispatcher is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LAVA Dispatcher is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along
+# with this program; if not, see <http://www.gnu.org/licenses>.
+
+from lava_dispatcher.actions import BaseAction
+
+class cmd_foo(BaseAction):
+ def run(self):
+ """ do something """
+ print("Hello from demo-action-plugin")
+
=== added file 'doc/examples/plugins/demo-action-plugin/setup.py'
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+from setuptools import setup
+
+setup (
+ name='demo-action-plugin',
+ version='0.0.1',
+ author='Paul Larson',
+ author_email='paul.larson@linaro.org',
+ url='',
+ description='LAVA Dispatcher plugin test',
+ packages = ['demo_action_plugin'],
+ entry_points="""
+ [lava_dispatcher.actions]
+ foo = demo_action_plugin.foo:cmd_foo
+ """,
+ zip_safe=False,
+ include_package_data=True
+ )
=== modified file 'lava_dispatcher/actions/__init__.py'
@@ -65,9 +65,13 @@
return cmds
def get_all_cmds():
+ import pkg_resources
cmds = {}
cmd_path = os.path.dirname(os.path.realpath(__file__))
for f in glob(os.path.join(cmd_path,"*.py")):
module = imp.load_source("module", os.path.join(cmd_path,f))
cmds.update(_find_commands(module))
+ for ep in pkg_resources.iter_entry_points(group="lava_dispatcher.actions"):
+ plugin = ep.load()
+ cmds[plugin.command_name] = plugin
return cmds