[Erp5-report] r44084 luke - /erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 9 17:54:12 CET 2011


Author: luke
Date: Wed Mar  9 17:54:12 2011
New Revision: 44084

URL: http://svn.erp5.org?rev=44084&view=rev
Log:
 - follow PEP8 specification of code

Modified:
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py

Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py?rev=44084&r1=44083&r2=44084&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py [utf8] Wed Mar  9 17:54:12 2011
@@ -476,14 +476,14 @@ class Recipe(BaseSlapRecipe):
     apache_conf['pid_file'] = os.path.join(self.run_directory,
         prefix + '.pid')
     apache_conf['lock_file'] = os.path.join(self.run_directory,
-        prefix+'.lock')
+        prefix + '.lock')
     apache_conf['ip'] = ip
     apache_conf['port'] = port
     apache_conf['server_admin'] = 'admin@'
     apache_conf['error_log'] = os.path.join(self.log_directory,
-        prefix+'-error.log')
+        prefix + '-error.log')
     apache_conf['access_log'] = os.path.join(self.log_directory,
-        prefix+'-access.log')
+        prefix + '-access.log')
     return apache_conf
 
   def _writeApacheConfiguration(self, prefix, apache_conf):
@@ -498,14 +498,14 @@ class Recipe(BaseSlapRecipe):
           backend_port=self.backend_port,
           backend_path='/',
           port=apache_conf['port'],
-          vhname=path.replace('/',''),
+          vhname=path.replace('/', ''),
     )
     rewrite_rule = rewrite_rule_template % d
     apache_conf.update(**dict(
       path_enable=path,
       rewrite_rule=rewrite_rule
     ))
-    return self.createConfigurationFile(prefix+'.conf',
+    return self.createConfigurationFile(prefix + '.conf',
         pkg_resources.resource_string(__name__,
           'template/apache.zope.conf.in') % apache_conf)
 
@@ -520,21 +520,21 @@ SSLRandomSeed connect builtin
         self.getLocalIPv4Address(), CONFIG['login_apache_port_base'] + index)
     apache_conf['server_name'] = '%s' % apache_conf['ip']
     apache_conf['ssl_snippet'] = ssl_template % CONFIG
-    apache_config_file = self._writeApacheConfiguration('login_apache_%s'% index,
+    apache_config_file = self._writeApacheConfiguration('login_apache_%s' % index,
         apache_conf)
     self.path_list.append(apache_config_file)
     self.path_list.extend(zc.buildout.easy_install.scripts([(
-      'login_apache_%s'% index,
-        __name__+'.apache', 'runApache')], self.ws,
+      'login_apache_%s' % index,
+        __name__ + '.apache', 'runApache')], self.ws,
           sys.executable, self.wrapper_directory, arguments=[
             dict(
-              required_path_list = [CONFIG['login_certificate'],
+              required_path_list=[CONFIG['login_certificate'],
                 CONFIG['login_key']],
               binary=self.options['httpd_binary'],
               config=apache_config_file
             )
           ]))
-    self.connection_dict['login_%s'% index] = '%(ip)s:%(port)s'% apache_conf
+    self.connection_dict['login_%s' % index] = '%(ip)s:%(port)s' % apache_conf
 
   def installKeyAuthorisationApache(self, index):
     ssl_template = """SSLEngine on
@@ -548,7 +548,7 @@ SSLCARevocationPath %(ca_crl)s"""
         self.getLocalIPv4Address(),
         CONFIG['key_auth_apache_port_base'] + index)
     apache_conf['ssl_snippet'] = ssl_template % CONFIG
-    prefix = 'ssl_key_auth_apache_%s'% index
+    prefix = 'ssl_key_auth_apache_%s' % index
     rewrite_rule_template = \
         "RewriteRule (.*) http://%(backend_ip)s:%(backend_port)s%(key_auth_path)s$1 [L,P]"
     path_template = pkg_resources.resource_string(__name__,
@@ -560,7 +560,7 @@ SSLCARevocationPath %(ca_crl)s"""
           backend_port=self.backend_port,
           backend_path='/',
           port=apache_conf['port'],
-          vhname=path.replace('/',''),
+          vhname=path.replace('/', ''),
           key_auth_path=self.parameter_dict['key_auth_path'],
     )
     rewrite_rule = rewrite_rule_template % d
@@ -568,24 +568,24 @@ SSLCARevocationPath %(ca_crl)s"""
       path_enable=path,
       rewrite_rule=rewrite_rule
     ))
-    apache_config_file = self.createConfigurationFile(prefix+'.conf',
+    apache_config_file = self.createConfigurationFile(prefix + '.conf',
         pkg_resources.resource_string(__name__,
           'template/apache.zope.conf.in') % apache_conf)
     self.path_list.append(apache_config_file)
     self.path_list.extend(zc.buildout.easy_install.scripts([(
-      'key_auth_apache_%s'% index,
-        __name__+'.apache', 'runApache')], self.ws,
+      'key_auth_apache_%s' % index,
+        __name__ + '.apache', 'runApache')], self.ws,
           sys.executable, self.wrapper_directory, arguments=[
             dict(
-              required_path_list = [CONFIG['key_auth_certificate'],
+              required_path_list=[CONFIG['key_auth_certificate'],
                 CONFIG['key_auth_key'], CONFIG['ca_certificate'],
                 CONFIG['ca_crl']],
               binary=self.options['httpd_binary'],
               config=apache_config_file
             )
           ]))
-    self.connection_dict['key_auth_%s'% index] = \
-        '%(ip)s:%(port)s'% apache_conf
+    self.connection_dict['key_auth_%s' % index] = \
+        '%(ip)s:%(port)s' % apache_conf
 
   def installMysqlServer(self):
     mysql_conf = dict(
@@ -631,11 +631,11 @@ SSLCARevocationPath %(ca_crl)s"""
     mysql_script = pkg_resources.resource_string(__name__,
         'template/initmysql.sql.in') % mysql_conf
     self.path_list.extend(zc.buildout.easy_install.scripts([('mysql_update',
-      __name__+'.mysql', 'updateMysql')], self.ws,
+      __name__ + '.mysql', 'updateMysql')], self.ws,
       sys.executable, self.wrapper_directory, arguments=[mysql_command_list,
         mysql_script]))
     self.path_list.extend(zc.buildout.easy_install.scripts([('mysqld',
-      __name__+'.mysql', 'runMysql')], self.ws,
+      __name__ + '.mysql', 'runMysql')], self.ws,
         sys.executable, self.wrapper_directory, arguments=[
           initialise_command_list, {
         'mysqld_binary':self.options['mysqld_binary'],

Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py?rev=44084&r1=44083&r2=44084&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py [utf8] Wed Mar  9 17:54:12 2011
@@ -2,6 +2,7 @@ import os
 import sys
 import time
 
+
 def runApache(args):
   sleep = 60
   conf = args[0]

Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py?rev=44084&r1=44083&r2=44084&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py [utf8] Wed Mar  9 17:54:12 2011
@@ -2,6 +2,7 @@ import os
 import subprocess
 import time
 
+
 def popenCommunicate(command_list, input=None):
   subprocess_kw = dict(stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
   if input is not None:
@@ -15,6 +16,7 @@ def popenCommunicate(command_list, input
       result))
   return result
 
+
 def checkCertificateAuthority(ca_conf):
   file_list = [
       ca_conf['ca_key'],
@@ -47,8 +49,9 @@ def checkCertificateAuthority(ca_conf):
       pass
     raise
 
+
 def checkCertificate(common_name, key, certificate, ca_conf):
-  file_list = [ key, certificate ]
+  file_list = [key, certificate]
   ready = True
   for f in file_list:
     if not os.path.exists(f):
@@ -87,10 +90,12 @@ def checkLoginCertificate(ca_conf):
   checkCertificate('Login Based Access', ca_conf['login_key'],
       ca_conf['login_certificate'], ca_conf)
 
+
 def checkKeyAuthCertificate(ca_conf):
   checkCertificate('Key Based Access', ca_conf['key_auth_key'],
       ca_conf['key_auth_certificate'], ca_conf)
 
+
 def runCertificateAuthority(args):
   ca_conf = args[0]
   while True:

Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py?rev=44084&r1=44083&r2=44084&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py [utf8] Wed Mar  9 17:54:12 2011
@@ -4,12 +4,15 @@ import signal
 import subprocess
 import time
 
+
 def execute(args):
   """Portable execution with process replacement"""
   # Note: Candidate for slapos.lib.recipe
   os.execv(args[0], args)
 
 child_pg = None
+
+
 def sig_handler(signal, frame):
   print 'Received signal %r, killing children and exiting' % signal
   if child_pg is not None:
@@ -21,6 +24,7 @@ signal.signal(signal.SIGINT, sig_handler
 signal.signal(signal.SIGQUIT, sig_handler)
 signal.signal(signal.SIGTERM, sig_handler)
 
+
 def execute_with_signal_translation(args):
   """Run process as children and translate from SIGTERM to another signal"""
   child = subprocess.Popen(args, close_fds=True, preexec_fn=os.setsid)

Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py?rev=44084&r1=44083&r2=44084&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py [utf8] Wed Mar  9 17:54:12 2011
@@ -3,12 +3,13 @@ import subprocess
 import sys
 import time
 
+
 def runMysql(args):
   sleep = 60
   initialise_command_list = args[0]
   mysql_conf = args[1]
   mysql_wrapper_list = [mysql_conf['mysqld_binary'],
-      '--defaults-file=%s'%mysql_conf['configuration_file']]
+      '--defaults-file=%s' % mysql_conf['configuration_file']]
   while True:
     # XXX: Protect with proper root password
     popen = subprocess.Popen(initialise_command_list,
@@ -25,6 +26,7 @@ def runMysql(args):
   sys.stderr.flush()
   os.execl(mysql_wrapper_list[0], *mysql_wrapper_list)
 
+
 def updateMysql(args):
   mysql_command_list = args[0]
   mysql_script = args[1]



More information about the Erp5-report mailing list