django-orchestra-test/orchestra/contrib/webapps/backends/symboliclink.py
Santiago L 70042f3b5c Regenerate commit inicio 2023/07/09
commit 0f26b5a8e0
Author: jorgepastorr <jorge.pastor.rr@gmail.com>
Date:   Sun Jul 9 07:51:51 2023 +0000
Repo:   https://gitea.pangea.org/pangea/django-orchestra.git
2023-11-17 13:25:13 +01:00

36 lines
1.1 KiB
Python

import textwrap
from django.utils.translation import gettext_lazy as _
from orchestra.contrib.orchestration import ServiceController, replace
from .php import PHPController
class SymbolicLinkController(PHPController, ServiceController):
"""
Same as PHPController but allows you to have the webapps on a directory diferent than the webapps dir.
"""
verbose_name = _("Symbolic link webapp")
model = 'webapps.WebApp'
default_route_match = "webapp.type == 'symbolic-link'"
def create_webapp_dir(self, context):
self.append(textwrap.dedent("""\
if [[ ! -e %(app_path)s ]]; then
ln -s '%(link_path)s' %(app_path)s
fi
chown -h %(user)s:%(group)s %(app_path)s
""") % context
)
def set_under_construction(self, context):
pass
def get_context(self, webapp):
context = super(SymbolicLinkController, self).get_context(webapp)
context.update({
'link_path': webapp.data['path'],
})
return replace(context, "'", '"')