fixed http/content service
This commit is contained in:
parent
3c0555429c
commit
681edcd1c4
1 changed files with 9 additions and 11 deletions
|
|
@ -63,19 +63,17 @@ class HttpContentService(Service):
|
||||||
def needs_arguments(self):
|
def needs_arguments(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, job):
|
def execute(self, execution):
|
||||||
r = requests.get(self.protocol + "://" + job.get_host() + ":" + self.port + self.path)
|
|
||||||
|
|
||||||
|
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:
|
if self.content not in r.text:
|
||||||
job.set_errorcode(1)
|
error_code = 1
|
||||||
job.set_message("[http/content: " + job.jobHex + "] Failed on host: " + job.get_host() +
|
msg = "Failed"
|
||||||
" Content: " + str(self.content) + " not found.")
|
execution.set_result(error_code, msg, d)
|
||||||
|
|
||||||
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.")
|
|
||||||
|
|
||||||
|
|
||||||
def create(kwargs):
|
def create(kwargs):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue