Commits

theoden committed d96a80e

+ StaticSite.restart and WebApp.restart added, since what we just wanted by doing previous touches is a restart of web application.
Due to assumption that Project does not know App internals.

Comments (0)

Files changed (3)

fab_deploy/apps.py

         """ Install frontend software. """
         self.frontend.update_config()
 
+    @task_method
+    def restart(self):
+        # nothing to do in a static site case
+        pass
+
 
 class WebApp(StaticSite):
     __metaclass__ = ABCMeta
         super(WebApp, self).install_web_servers()
 
     @task_method
+    def restart(self):
+        """ Restarts web application.
+        
+        Usually by touching conf file or restarting backend.
+        """
+        # need this check assuming non-wsgi backends in the future
+        if hasattr(self.backend, 'touch'):
+            self.backend.touch()
+        else:
+            self.backend.restart()
+        
+    @task_method
     @abstractmethod
     def update_config(self, restart=True):
         """ Updates config of the web application. """

fab_deploy/pip.py

     what = utils._pip_req_path(what or env.conf.PIP_REQUIREMENTS_ACTIVE)
     run('pip install %s -r %s' % (options, what))
     if restart:
-        apache.touch()
+        for app in env.conf.APPS:
+            app.restart()
 
 @task
 @utils.inside_src
     what = utils._pip_req_path(what or env.conf.PIP_REQUIREMENTS_ACTIVE)
     run('pip install %s -U -r %s' % (options, what))
     if restart:
-        apache.touch()
+        for app in env.conf.APPS:
+            app.restart()
 
 @task
 def setup_conf(username=None):

fab_deploy/project.py

             vcs.up(branch)
         before_restart()
         for app in env.conf.APPS:
-            app.backend.touch()
+            app.restart()
     
     @task_method
     def push(self, *args, **kwargs):
         kwargs.get('before_restart', lambda: None)()
         for app in env.conf.APPS:
             if 'norestart' not in args:
-                app.backend.touch()
+                app.restart()
             if 'notest' not in args:
                 app.test()