From 9e3efcc106750fcd475a0dae785216963b3f7ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com> Date: Tue, 3 Apr 2012 09:08:39 +0200 Subject: [PATCH] apache : check for mandatory arguments and be more explicit if it is not present --- slapos/recipe/apache_frontend/__init__.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/slapos/recipe/apache_frontend/__init__.py b/slapos/recipe/apache_frontend/__init__.py index cba5be216..193e93ef7 100644 --- a/slapos/recipe/apache_frontend/__init__.py +++ b/slapos/recipe/apache_frontend/__init__.py @@ -42,6 +42,17 @@ class Recipe(BaseSlapRecipe): 'template/%s' % template_name) def _install(self): + # Check for mandatory arguments + frontend_domain_name = self.parameter_dict.get("domain") + if frontend_domain_name is None: + raise zc.buildout.UserError('No domain name specified. Please define ' + 'the "domain" instance parameter.') + + # Define optional arguments + frontend_port_number = self.parameter_dict.get("port", 4443) + base_varnish_port = 26009 + slave_instance_list = self.parameter_dict.get("slave_instance_list", []) + self.path_list = [] self.requirements, self.ws = self.egg.working_set() @@ -53,11 +64,6 @@ class Recipe(BaseSlapRecipe): 'killpidfromfile')], self.ws, sys.executable, self.bin_directory)[0] self.path_list.append(self.killpidfromfile) - frontend_port_number = self.parameter_dict.get("port", 4443) - frontend_domain_name = self.parameter_dict["domain"] - base_varnish_port = 26009 - slave_instance_list = self.parameter_dict.get("slave_instance_list", []) - rewrite_rule_list = [] rewrite_rule_zope_list = [] slave_dict = {} -- 2.30.9