mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-12-23 05:12:15 +03:00
sample plugin formatted
This commit is contained in:
parent
d596b9bd79
commit
06f65d0c35
10 changed files with 73 additions and 54 deletions
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||
|
||||
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()
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||
|
||||
|
||||
|
||||
def info():
|
||||
return None
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||
|
||||
|
||||
def handle_policy(profile_data,context):
|
||||
context.put('data','dataa')
|
||||
context.put('content_type','type')
|
||||
print("This is policy file - plugin 1")
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||
|
||||
|
||||
def handle_safe_mode(username,context):
|
||||
pass
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||
|
||||
def run(val):
|
||||
print("oo yeah plugin2 " + str(val))
|
5
opt/ahenk/plugins/sample/main.py
Normal file
5
opt/ahenk/plugins/sample/main.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
def info():
|
||||
return None
|
23
opt/ahenk/plugins/sample/policy.py
Normal file
23
opt/ahenk/plugins/sample/policy.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from base.plugin.abstract_plugin import AbstractPlugin
|
||||
|
||||
|
||||
class Sample(AbstractPlugin):
|
||||
def __init__(self, profile_data, context):
|
||||
super(Sample, self).__init__()
|
||||
self.profile_data = profile_data
|
||||
self.context = context
|
||||
self.logger = self.get_logger()
|
||||
|
||||
def handle_policy(self):
|
||||
# TODO Do what do you want to do!
|
||||
# TODO Don't Forget returning response with <self.context.create_response(..)>
|
||||
pass
|
||||
|
||||
|
||||
def handle_policy(profile_data, context):
|
||||
print('Sample Plugin Policy')
|
||||
sample = Sample(profile_data, context)
|
||||
sample.handle_policy()
|
22
opt/ahenk/plugins/sample/safe.py
Normal file
22
opt/ahenk/plugins/sample/safe.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from base.plugin.abstract_plugin import AbstractPlugin
|
||||
|
||||
|
||||
class Sample(AbstractPlugin):
|
||||
def __init__(self, username, context):
|
||||
super(Sample, self).__init__()
|
||||
self.username = username
|
||||
self.context = context
|
||||
self.logger = self.get_logger()
|
||||
|
||||
def handle_safe_mode(self):
|
||||
# TODO Do what do you want to do!
|
||||
pass
|
||||
|
||||
|
||||
def handle_safe_mode(username, context):
|
||||
print('Sample Plugin Safe')
|
||||
sample = Sample(username, context)
|
||||
sample.handle_safe_mode()
|
23
opt/ahenk/plugins/sample/task_command_id.py
Normal file
23
opt/ahenk/plugins/sample/task_command_id.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from base.plugin.abstract_plugin import AbstractPlugin
|
||||
|
||||
|
||||
class Sample(AbstractPlugin):
|
||||
def __init__(self, task, context):
|
||||
super(Sample, self).__init__()
|
||||
self.task = task
|
||||
self.context = context
|
||||
self.logger = self.get_logger()
|
||||
|
||||
def handle_task(self):
|
||||
# TODO Do what do you want to do!
|
||||
# TODO Don't Forget returning response with <self.context.create_response(..)>
|
||||
pass
|
||||
|
||||
|
||||
def handle_task(task, context):
|
||||
print('Sample Plugin Task')
|
||||
sample = Sample(task, context)
|
||||
sample.handle_task()
|
Loading…
Reference in a new issue