django-orchestra-test/orchestra/contrib/webapps/backends/symboliclink.py

28 lines
906 B
Python
Raw Normal View History

2015-03-04 21:06:16 +00:00
from django.utils.translation import ugettext_lazy as _
2015-04-05 10:46:24 +00:00
from orchestra.contrib.orchestration import ServiceController
2015-03-04 21:06:16 +00:00
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