Commits

Robert Myers  committed c116bff Merge

merging

  • Participants
  • Parent commits 7139bca, ced9c0c
  • Branches worker

Comments (0)

Files changed (2)

File cannula/conf.py

 # This must be writable by the user running cannula.
 CANNULA_BASE = '/cannula/'
 # Proxy client, default options are:
-#     'cannula.proxy.nginx.Proxy'
-#     'cannula.proxy.apache.Proxy'
+#     'cannula.proxy.nginx'
+#     'cannula.proxy.apache'
 #     or roll your own and provide the dotted path here
-CANNULA_PROXY = 'cannula.proxy.nginx.Proxy'
+CANNULA_PROXY = 'cannula.proxy.nginx'
 # VCS options by default all that are supported by pip
 # http://pip.openplans.org/
 CANNULA_VCS_ENABLED = ('svn', 'git', 'hg', 'bzr')
+# Worker types enabled
+CANNULA_WORKERS_ENABLED = ('uwsgi', 'gunicorn', 'fastcgi')
+# Flavors (project types) enabled
+CANNULA_FLAVORS_ENABLED = ('Django', 'Pylons', 'Paste', 'PHP')
 # API classes you can override a single one in django settings
 # this dictionary will be updated with the user defined one.
 CANNULA_API = {
     'bzr': 'Bazaar',
 }
 
+# TODO: need a registry system
 VCS_CHOICES = add_blank_choice([(vcs, _vcs_name[vcs]) for vcs in CANNULA_VCS_ENABLED])
-WORKER_CHOICES = add_blank_choice([]) # TODO: need a registry
+WORKER_CHOICES = add_blank_choice([(w, w) for w in CANNULA_WORKERS_ENABLED]) 
+FLAVOR_CHOICES = add_blank_choice([(f.lower(), f) for f in CANNULA_FLAVORS_ENABLED])
 
 # TODO: Delete these
 METHOD_CHOICES = []

File cannula/worker/__init__.py

-try:
-    import json
-except ImportError:
-    from django.utils import simplejson as json
-
-from cannula.conf import api
-
-class DeploymentError(Exception):
-    """Base class for all deployment exception classes."""
-
-class InvalidAction(DeploymentError):
-    """There was an attempt to run an invalid action"""
-
-class InvalidStatus(DeploymentError):
-    """The deployment is not in the correct state for this action."""
-
-class WorkerBase(object):
-    """Base Worker class. Subclasses need to define 'deploy', 'delete' 
-    and 'modify'
-    """
-    
-    # The process runner, name used for templates ('uwsgi', 'gunicorn', 'fastcgi')
-    worker = ''
-    # The project type ('django', 'pylons', 'paste', 'php')
-    project_type = ''
-    
-    
-    def defaults(self, cluster):
-        """Return a dictionary of the default values for this cluster."""
-        cluster = api.clusters.get(cluster)
-        return json.loads(cluster.defaults)
-    
-    def deploy(self, *args, **kwargs):
-        raise NotImplementedError
-    
-    def delete(self, *args, **kwargs):
-        raise NotImplementedError
-    
-    def modify(self, *args, **kwargs):
-        """Start|stop|restart the application.
-        Raises 'InvalidAction' and 'InvalidStatus'"""
-        raise NotImplementedError