Commit f4f186a6 authored by Vivien Alger's avatar Vivien Alger

New promise recipe for checking page content with phantomjs

parent fa32bcc7
......@@ -84,6 +84,7 @@ setup(name=name,
'certificate_authority = slapos.recipe.certificate_authority:Recipe',
'certificate_authority.request = slapos.recipe.certificate_authority:Request',
'check_page_content = slapos.recipe.check_page_content:Recipe',
'check_page_content_phantomjs' = 'slapos.recipe.check_page_content:PhantomJSRecipe',
'check_port_listening = slapos.recipe.check_port_listening:Recipe',
'check_url_available = slapos.recipe.check_url_available:Recipe',
'cloud9 = slapos.recipe.cloud9:Recipe',
......
......@@ -49,3 +49,26 @@ class Recipe(GenericBaseRecipe):
)
return [promise]
class PhantomJSRecipe(GenericBaseRecipe):
"""
Create script for checking page content at url with js script
"""
def install(self):
config = {
'script-path': self.options['script-path'].strip(),
'dash-path': self.options['dash-path'].strip(),
'phantomjs-path': self.options['phantomjs-path'].strip(),
'phantomjs-options': self.options.get('phantomjs-options','')
}
promise = self.createExecutable(
self.options['path'].strip(),
self.substituteTemplate(
self.getTemplateFilename('check_page_content_phantomjs.in'),
config
)
)
return [promise]
\ No newline at end of file
#!%(dash-path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
%(phantomjs-path)s %(phantomjs-options)s %(script-path)s
if [ $? != 0 ]; then
echo "PhantomJS script returned non zero output" >&2
exit 1
fi
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment