From d3b621baac54c0100343b4e57ace97d12a259841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Mon, 9 May 2016 15:06:28 +0300 Subject: [PATCH] sample plugins --- opt/ahenk/plugins/plugin1/command1.py | 24 ++++++++++++++++++++++++ opt/ahenk/plugins/plugin1/command2.py | 0 opt/ahenk/plugins/plugin1/main.py | 8 ++++++++ opt/ahenk/plugins/plugin1/policy.py | 9 +++++++++ opt/ahenk/plugins/plugin1/safe.py | 7 +++++++ opt/ahenk/plugins/plugin2/main.py | 6 ++++++ 6 files changed, 54 insertions(+) create mode 100644 opt/ahenk/plugins/plugin1/command1.py create mode 100644 opt/ahenk/plugins/plugin1/command2.py create mode 100644 opt/ahenk/plugins/plugin1/main.py create mode 100644 opt/ahenk/plugins/plugin1/policy.py create mode 100644 opt/ahenk/plugins/plugin1/safe.py create mode 100644 opt/ahenk/plugins/plugin2/main.py diff --git a/opt/ahenk/plugins/plugin1/command1.py b/opt/ahenk/plugins/plugin1/command1.py new file mode 100644 index 0000000..0d6e479 --- /dev/null +++ b/opt/ahenk/plugins/plugin1/command1.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Author: İsmail BAŞARAN + +from base.plugin.AbstractCommand import AbstractCommand + +class MySamplePlugin(AbstractCommand): + """docstring for MySamplePlugin""" + def __init__(self, task): + super(MySamplePlugin, self).__init__() + self.task = task + + def handle_task(self): + print("This is command 1 ") + print("parameter map="+self.task.parameter_map) + + +def handle_task(task,context): + # Do what ever you want here + # You can create command class but it is not necessary + # You can use directly this method. + context.put('my_data_name','my data') + myPlugin = MySamplePlugin(task) + myPlugin.handle_task() diff --git a/opt/ahenk/plugins/plugin1/command2.py b/opt/ahenk/plugins/plugin1/command2.py new file mode 100644 index 0000000..e69de29 diff --git a/opt/ahenk/plugins/plugin1/main.py b/opt/ahenk/plugins/plugin1/main.py new file mode 100644 index 0000000..59d591a --- /dev/null +++ b/opt/ahenk/plugins/plugin1/main.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Author: İsmail BAŞARAN + + + +def info(): + return None diff --git a/opt/ahenk/plugins/plugin1/policy.py b/opt/ahenk/plugins/plugin1/policy.py new file mode 100644 index 0000000..b7a9bf8 --- /dev/null +++ b/opt/ahenk/plugins/plugin1/policy.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Author: İsmail BAŞARAN + + +def handle_policy(profile_data,context): + context.put('data','dataa') + context.put('content_type','type') + print("This is policy file - plugin 1") diff --git a/opt/ahenk/plugins/plugin1/safe.py b/opt/ahenk/plugins/plugin1/safe.py new file mode 100644 index 0000000..062a10c --- /dev/null +++ b/opt/ahenk/plugins/plugin1/safe.py @@ -0,0 +1,7 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Author: İsmail BAŞARAN + + +def handle_safe_mode(username,context): + pass \ No newline at end of file diff --git a/opt/ahenk/plugins/plugin2/main.py b/opt/ahenk/plugins/plugin2/main.py new file mode 100644 index 0000000..e036c25 --- /dev/null +++ b/opt/ahenk/plugins/plugin2/main.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Author: İsmail BAŞARAN + +def run(val): + print("oo yeah plugin2 " + str(val))