Commits

theoden committed 960c2d6

* Several instances of the Nginx are now possible for the same INSTANCE_NAME
test for Project.remove is broken

Comments (0)

Files changed (1)

fab_deploy/webserver/nginx.py

     
     def __init__(self, config='nginx.conf'):
         self.config = config
-        
+
+    def _get_server_config_name(self):
+        return '%s_%s' % (env.conf['INSTANCE_NAME'], self.config)
+
     @task_method
     @utils.run_as_sudo
     def install(self):
         options = {'lenny': '-t lenny-backports'}
         system.aptitude_install('nginx', options.get(os, ''))
         sudo('rm -f /etc/nginx/sites-enabled/default')
-    
+
     @task_method
     @utils.run_as_sudo
     def update_config(self):
         """ Updates nginx config and restarts nginx. """
-        name = env.conf['INSTANCE_NAME']
+        name = self._get_server_config_name()
         utils.upload_config_template(self.config,
                                      '/etc/nginx/sites-available/%s' % name,
                                      use_sudo=True)
         with settings(warn_only=True):
             sudo('ln -s /etc/nginx/sites-available/%s /etc/nginx/sites-enabled/%s' % (name, name))
         sudo('invoke-rc.d nginx restart')
+
+    @task_method
+    @utils.run_as_sudo
+    def disable_config(self):
+        """ Disables nginx config and reloads nginx. """
+        sudo('rm -f /etc/nginx/sites-enabled/' + self._get_server_config_name())
+        sudo('invoke-rc.d nginx reload')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.