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 remote_path = "%s.remote" % path
log.script = '# %s\n%s' % (remote_path, script) log.script = '# %s\n%s' % (remote_path, script)
log.save(update_fields=['script']) log.save(update_fields=['script'])
if not cmds:
return
channel = None channel = None
ssh = None ssh = None
try: try:

View file

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

View file

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