From 681edcd1c4f64442d25d68da62ec113cc7fc9888 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Mon, 11 Nov 2013 05:00:32 +0100 Subject: [PATCH] fixed http/content service --- linspector/services/http/content.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/linspector/services/http/content.py b/linspector/services/http/content.py index 427f218..d120360 100644 --- a/linspector/services/http/content.py +++ b/linspector/services/http/content.py @@ -63,19 +63,17 @@ class HttpContentService(Service): def needs_arguments(self): return True - def execute(self, job): - r = requests.get(self.protocol + "://" + job.get_host() + ":" + self.port + self.path) + def execute(self, execution): + r = requests.get(self.protocol + "://" + execution.get_host_name() + ":" + self.port + self.path) + + d = {"Expected": str(self.content)} + error_code = 0 + msg = "Success" if self.content not in r.text: - job.set_errorcode(1) - job.set_message("[http/content: " + job.jobHex + "] Failed on host: " + job.get_host() + - " Content: " + str(self.content) + " not found.") - - if job.get_errorcode() == -1: - job.set_execution_successful(True) - job.set_errorcode(0) - job.set_message("[http/content: " + job.jobHex + "] Success on host: " + job.get_host() + - " Content: " + str(self.content) + " found.") + error_code = 1 + msg = "Failed" + execution.set_result(error_code, msg, d) def create(kwargs):