Fixed php backends init variables and skip execution of empty backends

This commit is contained in:
Marc 2014-11-10 10:04:52 +00:00
parent d3b100b619
commit dbf64f2562
3 changed files with 10 additions and 3 deletions

View File

@ -28,7 +28,8 @@ def BashSSH(backend, log, server, cmds):
remote_path = "%s.remote" % path
log.script = '# %s\n%s' % (remote_path, script)
log.save(update_fields=['script'])
if not cmds:
return
channel = None
ssh = None
try:

View File

@ -37,6 +37,8 @@ class PHPFcgidBackend(WebAppServiceMixin, ServiceController):
self.delete_webapp_dir(context)
def commit(self):
if not self.cmds:
return
super(PHPFcgidBackend, self).commit()
self.append("[[ $UPDATED_APACHE == 1 ]] && { service apache2 reload; }")
@ -44,7 +46,7 @@ class PHPFcgidBackend(WebAppServiceMixin, ServiceController):
context = super(PHPFcgidBackend, self).get_context(webapp)
init_vars = self.get_php_init_vars(webapp)
if init_vars:
init_vars = [ '%s="%s"' % (k,v) for v,k in init_vars.iteritems() ]
init_vars = [ '%s="%s"' % (k,v) for v,k in init_vars ]
init_vars = ', -d '.join(init_vars)
context['init_vars'] = '-d %s' % init_vars
else:

View File

@ -29,11 +29,15 @@ class PHPFPMBackend(WebAppServiceMixin, ServiceController):
}""" % context))
def delete(self, webapp):
if not self.valid_directive(webapp):
return
context = self.get_context(webapp)
self.append("rm '%(fpm_path)s'" % context)
self.delete_webapp_dir(context)
def commit(self):
if not self.cmds:
return
super(PHPFPMBackend, self).commit()
self.append(textwrap.dedent("""
[[ $UPDATEDFPM == 1 ]] && {
@ -61,7 +65,7 @@ class PHPFPMBackend(WebAppServiceMixin, ServiceController):
listen.group = {{ group }}
pm = ondemand
pm.max_children = 4
{% for name,value in init_vars.iteritems %}
{% for name,value in init_vars %}
php_admin_value[{{ name | safe }}] = {{ value | safe }}{% endfor %}"""
))
context.update({