From 90c41027c69486d83b39dade0acef2d4dae7add7 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Wed, 5 Jun 2013 00:09:24 +0200 Subject: [PATCH] added shell service and fixed service --- lib/service/service.py | 9 ++++----- lib/service/shell.py | 20 +++++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/service/service.py b/lib/service/service.py index 6de8e3c..1664152 100644 --- a/lib/service/service.py +++ b/lib/service/service.py @@ -1,14 +1,13 @@ - class Service: - def __init__(self): - pass + def __init__(self, parser): + self.parser = parser def _execute(self): self.pre_execute() self.execute() self.parse_result() self.handle_result() - + def execute(self): pass @@ -16,7 +15,7 @@ class Service: pass def parse_result(self): - pass + self.parser._parse() def handle_result(self): pass \ No newline at end of file diff --git a/lib/service/shell.py b/lib/service/shell.py index 234b714..7b7e470 100644 --- a/lib/service/shell.py +++ b/lib/service/shell.py @@ -1,4 +1,18 @@ """ -The shell service. This is for executing services as shell commands and don't use a builtin function. This is useful to -be free to do what you want. -""" \ No newline at end of file +The shell service. This is for executing services as shell commands +and don't use a builtin function. This is useful to be free to do what you want. +""" + +from service import Service + + +class ShellService(Service): + def __init__(self, parser, log, **kwargs): + super(Service, self).__init__(parser) + if "command" in kwargs: + self.command = kwargs["command"] + else: + log.w("There is no command") + + def execute(self): + self.command.call() \ No newline at end of file