Commit 82f22089 authored by Alain Takoudjou's avatar Alain Takoudjou

Update check_page_content recipe to use custom patrern

parent deb551d4
...@@ -29,15 +29,17 @@ import sys ...@@ -29,15 +29,17 @@ import sys
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
""" """
Create script that will check if content at "url" is available Create script that will check if content at "url" is available
(e.g page has a link to itself). (e.g page has a link to itself).
""" """
def install(self): def install(self):
url = self.options['url'].strip()
config = { config = {
'url': self.options['url'], 'url': url,
'shell_path': self.options['dash_path'], 'shell_path': self.options['dash_path'],
'curl_path': self.options['curl_path'], 'curl_path': self.options['curl_path'],
'pattern': self.options.get('pattern', url),
} }
# XXX-Cedric in this script, curl won't check certificate # XXX-Cedric in this script, curl won't check certificate
......
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
# BEWARE: It will be overwritten automatically # BEWARE: It will be overwritten automatically
URL="%(url)s" URL="%(url)s"
PATTERN="%(pattern)s"
if [ -z $URL ]; then if [ -z $URL ]; then
echo "No URL specified." >&2 echo "No URL specified." >&2
exit 3 exit 3
fi fi
%(curl_path)s -k -sL $URL | grep "$URL" > /dev/null %(curl_path)s -k -sL $URL | grep "$PATTERN" > /dev/null
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Content at $URL seems to be corrupted" >&2 echo "Content at $URL seems to be corrupted" >&2
......
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