django-orchestra/orchestra/apps/webapps/backends/symboliclink.py
2015-03-04 21:06:16 +00:00

28 lines
903 B
Python

from django.utils.translation import ugettext_lazy as _
from orchestra.apps.orchestration import ServiceController
from . import WebAppServiceMixin
class SymbolicLinkBackend(WebAppServiceMixin, ServiceController):
verbose_name = _("Symbolic link webapp")
model = 'webapps.WebApp'
default_route_match = "webapp.type == 'symbolic-link'"
def save(self, webapp):
context = self.get_context(webapp)
self.append("ln -s '%(link_path)s' %(app_path)s" % context)
self.append("chown -h %(user)s:%(group)s %(app_path)s" % context)
def delete(self, webapp):
context = self.get_context(webapp)
self.delete_webapp_dir(context)
def get_context(self, webapp):
context = super(SymbolicLinkBackend, self).get_context(webapp)
context.update({
'link_path': webapp.data['path'],
})
return context