From dbf64f25623e61f19977f0c04f93fa7d85615835 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 10 Nov 2014 10:04:52 +0000 Subject: [PATCH] Fixed php backends init variables and skip execution of empty backends --- orchestra/apps/orchestration/methods.py | 3 ++- orchestra/apps/webapps/backends/phpfcgid.py | 4 +++- orchestra/apps/webapps/backends/phpfpm.py | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/orchestra/apps/orchestration/methods.py b/orchestra/apps/orchestration/methods.py index 634a08a2..263d2dbb 100644 --- a/orchestra/apps/orchestration/methods.py +++ b/orchestra/apps/orchestration/methods.py @@ -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: diff --git a/orchestra/apps/webapps/backends/phpfcgid.py b/orchestra/apps/webapps/backends/phpfcgid.py index 0552d15d..a6447a70 100644 --- a/orchestra/apps/webapps/backends/phpfcgid.py +++ b/orchestra/apps/webapps/backends/phpfcgid.py @@ -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: diff --git a/orchestra/apps/webapps/backends/phpfpm.py b/orchestra/apps/webapps/backends/phpfpm.py index eb5e001a..5fe378d2 100644 --- a/orchestra/apps/webapps/backends/phpfpm.py +++ b/orchestra/apps/webapps/backends/phpfpm.py @@ -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({