From f1ed5da2d1014bb3f017b51a9b1b95e5b10f55d9 Mon Sep 17 00:00:00 2001
From: Tatuya Kamada <tatuya@nexedi.com>
Date: Wed, 25 Apr 2012 17:30:36 +0900
Subject: [PATCH] Add a parameter to configure the entry point url for web
 checker.

---
 slapos/recipe/README.generic_varnish.txt | 4 ++++
 slapos/recipe/web_checker/__init__.py    | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/slapos/recipe/README.generic_varnish.txt b/slapos/recipe/README.generic_varnish.txt
index 358b787db..0d3b92da4 100644
--- a/slapos/recipe/README.generic_varnish.txt
+++ b/slapos/recipe/README.generic_varnish.txt
@@ -13,6 +13,7 @@ instance = request(
   software_type='varnish',
   partition_parameter_kw={
      'tidstorage-url':'http://[your tidstrage address]:your tid strage port',
+     'web-checker-frontend-url':'http://www.example.com',
      'web-checker-mail-address':'web-checker-result@example.com',
      'web-checker-smtp-host':'mail.example.com',
   }
@@ -21,6 +22,9 @@ instance = request(
 tidstrage-url is the backend url that varnish will cache. It is expected that
 the backend is created by tidstorage recipe.
 
+web-checker-frontend-url is the entry-point-url that web checker will check
+the HTTP headers of all the pages in the web site.
+
 web-checker-mail-address is the email address where web checker will send
 the HTTP Cache cheking result.
 
diff --git a/slapos/recipe/web_checker/__init__.py b/slapos/recipe/web_checker/__init__.py
index 4101e5bf4..a7c3a6e26 100644
--- a/slapos/recipe/web_checker/__init__.py
+++ b/slapos/recipe/web_checker/__init__.py
@@ -36,13 +36,17 @@ class Recipe(GenericSlapRecipe):
     path_list = []
     web_checker_mail_address = self.parameter_dict['web-checker-mail-address']
     web_checker_smtp_host = self.parameter_dict['web-checker-smtp-host']
+    web_checker_frontend_url = self.parameter_dict.get(
+                                'web-checker-frontend-url')
+    if web_checker_frontend_url is None:
+      web_checker_frontend_url = self.options['frontend-url']
     web_checker_working_directory = \
       self.options['web-checker-working-directory']
     config = dict(
       web_checker_mail_address = web_checker_mail_address,
       web_checker_smtp_host = web_checker_smtp_host,
       web_checker_working_directory = web_checker_working_directory,
-      frontend_url = self.options['frontend-url'],
+      frontend_url = web_checker_frontend_url,
       wget_binary_path = self.options['wget-binary-path'],
       varnishlog_binary_path = self.options['varnishlog-binary-path'],
       web_checker_log = self.options['web-checker-log'],
-- 
2.30.9