Add match support for promise check_page_content.

If match parameter is defined, it will grep this instead of URL.
parent bb8a1bce
...@@ -38,6 +38,7 @@ class Recipe(GenericBaseRecipe): ...@@ -38,6 +38,7 @@ class Recipe(GenericBaseRecipe):
'url': self.options['url'], 'url': self.options['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'],
'match': self.options.get('match', self.options['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"
MATCH='%(match)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 "$MATCH" > /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