Renamed backends to controllers

This commit is contained in:
Marc Aymerich 2016-03-08 10:16:49 +00:00
parent 5e2ec5797f
commit 1bb6b9f849
34 changed files with 73 additions and 76 deletions

View file

@ -306,7 +306,7 @@ method(
arg, arg, arg)
Bash/Python/PHPBackend
Bash/Python/PHPController
# services.handler as generator in order to save memory? not swell like a balloon
@ -431,6 +431,3 @@ mkhomedir_helper or create ssh homes with bash.rc and such
# Automatically re-run backends until success? only timedout executions?
# TODO save serialized versions ob backendoperation.instance in order to allow backend reexecution of deleted objects
# Rename Backend -> COntroller

View file

@ -8,7 +8,7 @@ from orchestra.contrib.resources import ServiceMonitor
from . import settings
class MySQLBackend(ServiceController):
class MySQLController(ServiceController):
"""
Simple backend for creating MySQL databases using <tt>CREATE DATABASE</tt> statement.
"""
@ -58,7 +58,7 @@ class MySQLBackend(ServiceController):
mysql -e 'FLUSH PRIVILEGES;'\
""")
)
super(MySQLBackend, self).commit()
super(MySQLController, self).commit()
def get_context(self, database):
context = {
@ -68,7 +68,7 @@ class MySQLBackend(ServiceController):
return replace(replace(context, "'", '"'), ';', '')
class MySQLUserBackend(ServiceController):
class MySQLUserController(ServiceController):
"""
Simple backend for creating MySQL users using <tt>CREATE USER</tt> statement.
"""

View file

@ -135,11 +135,11 @@ class DatabaseTestMixin(object):
self.validate_create_table(dbname, username2, password2)
class MySQLBackendMixin(object):
class MySQLControllerMixin(object):
db_type = 'mysql'
def setUp(self):
super(MySQLBackendMixin, self).setUp()
super(MySQLControllerMixin, self).setUp()
# Get local ip address used to reach self.MASTER_SERVER
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((self.MASTER_SERVER, 22))
@ -148,11 +148,11 @@ class MySQLBackendMixin(object):
def add_route(self):
server = Server.objects.create(name=self.MASTER_SERVER)
backend = backends.MySQLBackend.get_name()
backend = backends.MySQLController.get_name()
match = "database.type == '%s'" % self.db_type
Route.objects.create(backend=backend, match=match, host=server)
match = "databaseuser.type == '%s'" % self.db_type
backend = backends.MySQLUserBackend.get_name()
backend = backends.MySQLUserController.get_name()
Route.objects.create(backend=backend, match=match, host=server)
def validate_create_table(self, name, username, password):
@ -337,9 +337,9 @@ class AdminDatabaseMixin(DatabaseTestMixin):
self.admin_delete(user)
class RESTMysqlDatabaseTest(MySQLBackendMixin, RESTDatabaseMixin, BaseLiveServerTestCase):
class RESTMysqlDatabaseTest(MySQLControllerMixin, RESTDatabaseMixin, BaseLiveServerTestCase):
pass
class AdminMysqlDatabaseTest(MySQLBackendMixin, AdminDatabaseMixin, BaseLiveServerTestCase):
class AdminMysqlDatabaseTest(MySQLControllerMixin, AdminDatabaseMixin, BaseLiveServerTestCase):
pass

View file

@ -12,7 +12,7 @@ from . import settings
from .models import Record, Domain
class Bind9MasterDomainBackend(ServiceController):
class Bind9MasterDomainController(ServiceController):
"""
Bind9 zone and config generation.
It auto-discovers slave Bind9 servers based on your routing configuration and NS servers.
@ -33,7 +33,7 @@ class Bind9MasterDomainBackend(ServiceController):
@classmethod
def is_main(cls, obj):
""" work around Domain.top self relationship """
if super(Bind9MasterDomainBackend, cls).is_main(obj):
if super(Bind9MasterDomainController, cls).is_main(obj):
return not obj.top
def save(self, domain):
@ -118,7 +118,7 @@ class Bind9MasterDomainBackend(ServiceController):
def get_masters_ips(self, domain):
ips = list(settings.DOMAINS_MASTERS)
if not ips:
ips += self.get_servers(domain, Bind9MasterDomainBackend)
ips += self.get_servers(domain, Bind9MasterDomainController)
return OrderedSet(sorted(ips))
def get_slaves(self, domain):
@ -144,7 +144,7 @@ class Bind9MasterDomainBackend(ServiceController):
ips.append(addr)
# Slaves from internal networks
if not settings.DOMAINS_MASTERS:
for server in self.get_servers(domain, Bind9SlaveDomainBackend):
for server in self.get_servers(domain, Bind9SlaveDomainController):
ips.append(server)
return OrderedSet(sorted(ips))
@ -171,7 +171,7 @@ class Bind9MasterDomainBackend(ServiceController):
return context
class Bind9SlaveDomainBackend(Bind9MasterDomainBackend):
class Bind9SlaveDomainController(Bind9MasterDomainController):
"""
Generate the configuartion for slave servers
It auto-discover the master server based on your routing configuration or you can use

View file

@ -310,10 +310,10 @@ class Bind9BackendMixin(object):
def add_route(self):
master = Server.objects.create(name=self.MASTER_SERVER, address=self.MASTER_SERVER_ADDR)
backend = backends.Bind9MasterDomainBackend.get_name()
backend = backends.Bind9MasterDomainController.get_name()
Route.objects.create(backend=backend, match=True, host=master)
slave = Server.objects.create(name=self.SLAVE_SERVER, address=self.SLAVE_SERVER_ADDR)
backend = backends.Bind9SlaveDomainBackend.get_name()
backend = backends.Bind9SlaveDomainController.get_name()
Route.objects.create(backend=backend, match=True, host=slave)

View file

@ -9,7 +9,7 @@ from . import settings
from .models import List
class MailmanVirtualDomainBackend(ServiceController):
class MailmanVirtualDomainController(ServiceController):
"""
Only syncs virtualdomains used on mailman addresses
"""
@ -62,7 +62,7 @@ class MailmanVirtualDomainBackend(ServiceController):
service postfix reload
fi""") % context
)
super(MailmanVirtualDomainBackend, self).commit()
super(MailmanVirtualDomainController, self).commit()
def get_context_files(self):
return {
@ -77,10 +77,10 @@ class MailmanVirtualDomainBackend(ServiceController):
return replace(context, "'", '"')
class MailmanBackend(MailmanVirtualDomainBackend):
class MailmanController(MailmanVirtualDomainController):
"""
Mailman 2 backend based on <tt>newlist</tt>, it handles custom domains.
Includes <tt>MailmanVirtualDomainBackend</tt>
Includes <tt>MailmanVirtualDomainController</tt>
"""
verbose_name = "Mailman"
address_suffixes = [
@ -202,7 +202,7 @@ class MailmanBackend(MailmanVirtualDomainBackend):
}
def get_banner(self, mail_list):
banner = super(MailmanBackend, self).get_banner()
banner = super(MailmanController, self).get_banner()
return '%s %s' % (banner, mail_list.name)
def get_context(self, mail_list):

View file

@ -79,7 +79,7 @@ class ListMixin(object):
def add_route(self):
server = Server.objects.create(name=self.MASTER_SERVER)
backend = backends.MailmanBackend.get_name()
backend = backends.MailmanController.get_name()
Route.objects.create(backend=backend, match=True, host=server)
def test_add(self):

View file

@ -53,7 +53,7 @@ class SieveFilteringMixin:
self.append('chown %(user)s:%(group)s %(filtering_path)s' % context)
class UNIXUserMaildirBackend(SieveFilteringMixin, ServiceController):
class UNIXUserMaildirController(SieveFilteringMixin, ServiceController):
"""
Assumes that all system users on this servers all mail accounts.
If you want to have system users AND mailboxes on the same server you should consider using virtual mailboxes.
@ -149,7 +149,7 @@ class UNIXUserMaildirBackend(SieveFilteringMixin, ServiceController):
return context
#class DovecotPostfixPasswdVirtualUserBackend(SieveFilteringMixin, ServiceController):
#class DovecotPostfixPasswdVirtualUserController(SieveFilteringMixin, ServiceController):
# """
# WARNING: This backends is not fully implemented
# """
@ -242,7 +242,7 @@ class UNIXUserMaildirBackend(SieveFilteringMixin, ServiceController):
# return context
class PostfixAddressVirtualDomainBackend(ServiceController):
class PostfixAddressVirtualDomainController(ServiceController):
"""
Secondary SMTP server without mailboxes in it, only syncs virtual domains.
"""
@ -326,9 +326,9 @@ class PostfixAddressVirtualDomainBackend(ServiceController):
return context
class PostfixAddressBackend(PostfixAddressVirtualDomainBackend):
class PostfixAddressController(PostfixAddressVirtualDomainController):
"""
Addresses based on Postfix virtual alias domains, includes <tt>PostfixAddressVirtualDomainBackend</tt>.
Addresses based on Postfix virtual alias domains, includes <tt>PostfixAddressVirtualDomainController</tt>.
"""
verbose_name = _("Postfix address")
doc_settings = (settings, (
@ -413,7 +413,7 @@ class PostfixAddressBackend(PostfixAddressVirtualDomainBackend):
)
class AutoresponseBackend(ServiceController):
class AutoresponseController(ServiceController):
"""
WARNING: not implemented
"""

View file

@ -41,7 +41,7 @@ class MailboxMixin(object):
server = Server.objects.create(name=self.MASTER_SERVER)
backend = backends.PasswdVirtualUserBackend.get_name()
Route.objects.create(backend=backend, match=True, host=server)
backend = backends.PostfixAddressBackend.get_name()
backend = backends.PostfixAddressController.get_name()
Route.objects.create(backend=backend, match=True, host=server)
def add_quota_resource(self):

View file

@ -50,7 +50,7 @@ class Migration(migrations.Migration):
name='Route',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
('backend', models.CharField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic'), ('Apache2Backend', '[S] Apache 2'), ('BSCWBackend', '[S] BSCW SaaS'), ('Bind9MasterDomainBackend', '[S] Bind9 master domain'), ('Bind9SlaveDomainBackend', '[S] Bind9 slave domain'), ('DokuWikiMuBackend', '[S] DokuWiki multisite'), ('DovecotPostfixPasswdVirtualUserBackend', '[S] Dovecot-Postfix virtualuser'), ('DrupalMuBackend', '[S] Drupal multisite'), ('GitLabSaaSBackend', '[S] GitLab SaaS'), ('AutoresponseBackend', '[S] Mail autoresponse'), ('MailmanBackend', '[S] Mailman'), ('MySQLBackend', '[S] MySQL database'), ('MySQLUserBackend', '[S] MySQL user'), ('PHPBackend', '[S] PHP FPM/FCGID'), ('PostfixAddressBackend', '[S] Postfix address'), ('uWSGIPythonBackend', '[S] Python uWSGI'), ('StaticBackend', '[S] Static'), ('SymbolicLinkBackend', '[S] Symbolic link webapp'), ('UNIXUserMaildirBackend', '[S] UNIX maildir user'), ('UNIXUserBackend', '[S] UNIX user'), ('WebalizerAppBackend', '[S] Webalizer App'), ('WebalizerBackend', '[S] Webalizer Content'), ('WordPressBackend', '[S] Wordpress'), ('WordpressMuBackend', '[S] Wordpress multisite'), ('PhpListSaaSBackend', '[S] phpList SaaS')], max_length=256, verbose_name='backend')),
('backend', models.CharField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic'), ('Apache2Controller', '[S] Apache 2'), ('BSCWController', '[S] BSCW SaaS'), ('Bind9MasterDomainController', '[S] Bind9 master domain'), ('Bind9SlaveDomainController', '[S] Bind9 slave domain'), ('DokuWikiMuController', '[S] DokuWiki multisite'), ('DovecotPostfixPasswdVirtualUserController', '[S] Dovecot-Postfix virtualuser'), ('DrupalMuController', '[S] Drupal multisite'), ('GitLabSaaSController', '[S] GitLab SaaS'), ('AutoresponseController', '[S] Mail autoresponse'), ('MailmanController', '[S] Mailman'), ('MySQLController', '[S] MySQL database'), ('MySQLUserController', '[S] MySQL user'), ('PHPController', '[S] PHP FPM/FCGID'), ('PostfixAddressController', '[S] Postfix address'), ('uWSGIPythonController', '[S] Python uWSGI'), ('StaticController', '[S] Static'), ('SymbolicLinkController', '[S] Symbolic link webapp'), ('UNIXUserMaildirController', '[S] UNIX maildir user'), ('UNIXUserController', '[S] UNIX user'), ('WebalizerAppController', '[S] Webalizer App'), ('WebalizerController', '[S] Webalizer Content'), ('WordPressController', '[S] Wordpress'), ('WordpressMuController', '[S] Wordpress multisite'), ('PhpListSaaSController', '[S] phpList SaaS')], max_length=256, verbose_name='backend')),
('match', models.CharField(help_text='Python expression used for selecting the targe host, <em>instance</em> referes to the current object.', default='True', blank=True, max_length=256, verbose_name='match')),
('is_active', models.BooleanField(default=True, verbose_name='active')),
],

View file

@ -29,6 +29,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='route',
name='backend',
field=models.CharField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic'), ('Apache2Backend', '[S] Apache 2'), ('BSCWBackend', '[S] BSCW SaaS'), ('Bind9MasterDomainBackend', '[S] Bind9 master domain'), ('Bind9SlaveDomainBackend', '[S] Bind9 slave domain'), ('DokuWikiMuBackend', '[S] DokuWiki multisite'), ('DovecotPostfixPasswdVirtualUserBackend', '[S] Dovecot-Postfix virtualuser'), ('DrupalMuBackend', '[S] Drupal multisite'), ('GitLabSaaSBackend', '[S] GitLab SaaS'), ('AutoresponseBackend', '[S] Mail autoresponse'), ('MailmanBackend', '[S] Mailman'), ('MailmanVirtualDomainBackend', '[S] Mailman virtdomain-only'), ('MySQLBackend', '[S] MySQL database'), ('MySQLUserBackend', '[S] MySQL user'), ('PHPBackend', '[S] PHP FPM/FCGID'), ('PostfixAddressBackend', '[S] Postfix address'), ('PostfixAddressVirtualDomainBackend', '[S] Postfix address virtdomain-only'), ('uWSGIPythonBackend', '[S] Python uWSGI'), ('StaticBackend', '[S] Static'), ('SymbolicLinkBackend', '[S] Symbolic link webapp'), ('SyncBind9MasterDomainBackend', '[S] Sync Bind9 master domain'), ('SyncBind9SlaveDomainBackend', '[S] Sync Bind9 slave domain'), ('UNIXUserMaildirBackend', '[S] UNIX maildir user'), ('UNIXUserBackend', '[S] UNIX user'), ('WebalizerAppBackend', '[S] Webalizer App'), ('WebalizerBackend', '[S] Webalizer Content'), ('WordPressBackend', '[S] Wordpress'), ('WordpressMuBackend', '[S] Wordpress multisite'), ('PhpListSaaSBackend', '[S] phpList SaaS')], verbose_name='backend', max_length=256),
field=models.CharField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic'), ('Apache2Controller', '[S] Apache 2'), ('BSCWController', '[S] BSCW SaaS'), ('Bind9MasterDomainController', '[S] Bind9 master domain'), ('Bind9SlaveDomainController', '[S] Bind9 slave domain'), ('DokuWikiMuController', '[S] DokuWiki multisite'), ('DovecotPostfixPasswdVirtualUserController', '[S] Dovecot-Postfix virtualuser'), ('DrupalMuController', '[S] Drupal multisite'), ('GitLabSaaSController', '[S] GitLab SaaS'), ('AutoresponseController', '[S] Mail autoresponse'), ('MailmanController', '[S] Mailman'), ('MailmanVirtualDomainController', '[S] Mailman virtdomain-only'), ('MySQLController', '[S] MySQL database'), ('MySQLUserController', '[S] MySQL user'), ('PHPController', '[S] PHP FPM/FCGID'), ('PostfixAddressController', '[S] Postfix address'), ('PostfixAddressVirtualDomainController', '[S] Postfix address virtdomain-only'), ('uWSGIPythonController', '[S] Python uWSGI'), ('StaticController', '[S] Static'), ('SymbolicLinkController', '[S] Symbolic link webapp'), ('SyncBind9MasterDomainController', '[S] Sync Bind9 master domain'), ('SyncBind9SlaveDomainController', '[S] Sync Bind9 slave domain'), ('UNIXUserMaildirController', '[S] UNIX maildir user'), ('UNIXUserController', '[S] UNIX user'), ('WebalizerAppController', '[S] Webalizer App'), ('WebalizerController', '[S] Webalizer Content'), ('WordPressController', '[S] Wordpress'), ('WordpressMuController', '[S] Wordpress multisite'), ('PhpListSaaSController', '[S] phpList SaaS')], verbose_name='backend', max_length=256),
),
]

View file

@ -16,7 +16,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='route',
name='backend',
field=models.CharField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('ApacheTrafficByName', '[M] ApacheTrafficByName'), ('DokuWikiMuTraffic', '[M] DokuWiki MU Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic'), ('WordpressMuTraffic', '[M] Wordpress MU Traffic'), ('OwnCloudDiskQuota', '[M] ownCloud SaaS Disk Quota'), ('OwncloudTraffic', '[M] ownCloud SaaS Traffic'), ('PhpListTraffic', '[M] phpList SaaS Traffic'), ('Apache2Backend', '[S] Apache 2'), ('BSCWBackend', '[S] BSCW SaaS'), ('Bind9MasterDomainBackend', '[S] Bind9 master domain'), ('Bind9SlaveDomainBackend', '[S] Bind9 slave domain'), ('DokuWikiMuBackend', '[S] DokuWiki multisite'), ('DrupalMuBackend', '[S] Drupal multisite'), ('GitLabSaaSBackend', '[S] GitLab SaaS'), ('AutoresponseBackend', '[S] Mail autoresponse'), ('MailScannerSpamRuleBackend', '[S] MailScanner ruleset'), ('MailmanBackend', '[S] Mailman'), ('MailmanVirtualDomainBackend', '[S] Mailman virtdomain-only'), ('MoodleBackend', '[S] Moodle'), ('MoodleWWWRootBackend', '[S] Moodle WWWRoot (required)'), ('MoodleMuBackend', '[S] Moodle multisite'), ('MySQLBackend', '[S] MySQL database'), ('MySQLUserBackend', '[S] MySQL user'), ('PHPBackend', '[S] PHP FPM/FCGID'), ('PangeaProxmoxOVZ', '[S] PangeaProxmoxOVZ'), ('PostfixAddressBackend', '[S] Postfix address'), ('PostfixAddressVirtualDomainBackend', '[S] Postfix address virtdomain-only'), ('PostfixRecipientAccessBackend', '[S] Postfix recipient access'), ('ProxmoxOVZ', '[S] ProxmoxOVZ'), ('uWSGIPythonBackend', '[S] Python uWSGI'), ('StaticBackend', '[S] Static'), ('SymbolicLinkBackend', '[S] Symbolic link webapp'), ('SyncBind9MasterDomainBackend', '[S] Sync Bind9 master domain'), ('SyncBind9SlaveDomainBackend', '[S] Sync Bind9 slave domain'), ('UNIXUserMaildirBackend', '[S] UNIX maildir user'), ('UNIXUserBackend', '[S] UNIX user'), ('WebalizerAppBackend', '[S] Webalizer App'), ('WebalizerBackend', '[S] Webalizer Content'), ('WordPressURLBackend', '[S] WordPress URL'), ('WordPressBackend', '[S] Wordpress'), ('WordpressMuBackend', '[S] Wordpress multisite'), ('OwnCloudBackend', '[S] ownCloud SaaS'), ('PhpListSaaSBackend', '[S] phpList SaaS')], max_length=256, verbose_name='backend'),
field=models.CharField(choices=[('Apache2Traffic', '[M] Apache 2 Traffic'), ('ApacheTrafficByName', '[M] ApacheTrafficByName'), ('DokuWikiMuTraffic', '[M] DokuWiki MU Traffic'), ('DovecotMaildirDisk', '[M] Dovecot Maildir size'), ('Exim4Traffic', '[M] Exim4 traffic'), ('MailmanSubscribers', '[M] Mailman subscribers'), ('MailmanTraffic', '[M] Mailman traffic'), ('MysqlDisk', '[M] MySQL disk'), ('OpenVZTraffic', '[M] OpenVZTraffic'), ('PostfixMailscannerTraffic', '[M] Postfix-Mailscanner traffic'), ('UNIXUserDisk', '[M] UNIX user disk'), ('VsFTPdTraffic', '[M] VsFTPd traffic'), ('WordpressMuTraffic', '[M] Wordpress MU Traffic'), ('OwnCloudDiskQuota', '[M] ownCloud SaaS Disk Quota'), ('OwncloudTraffic', '[M] ownCloud SaaS Traffic'), ('PhpListTraffic', '[M] phpList SaaS Traffic'), ('Apache2Controller', '[S] Apache 2'), ('BSCWController', '[S] BSCW SaaS'), ('Bind9MasterDomainController', '[S] Bind9 master domain'), ('Bind9SlaveDomainController', '[S] Bind9 slave domain'), ('DokuWikiMuController', '[S] DokuWiki multisite'), ('DrupalMuController', '[S] Drupal multisite'), ('GitLabSaaSController', '[S] GitLab SaaS'), ('AutoresponseController', '[S] Mail autoresponse'), ('MailScannerSpamRuleController', '[S] MailScanner ruleset'), ('MailmanController', '[S] Mailman'), ('MailmanVirtualDomainController', '[S] Mailman virtdomain-only'), ('MoodleController', '[S] Moodle'), ('MoodleWWWRootController', '[S] Moodle WWWRoot (required)'), ('MoodleMuController', '[S] Moodle multisite'), ('MySQLController', '[S] MySQL database'), ('MySQLUserController', '[S] MySQL user'), ('PHPController', '[S] PHP FPM/FCGID'), ('PangeaProxmoxOVZ', '[S] PangeaProxmoxOVZ'), ('PostfixAddressController', '[S] Postfix address'), ('PostfixAddressVirtualDomainController', '[S] Postfix address virtdomain-only'), ('PostfixRecipientAccessController', '[S] Postfix recipient access'), ('ProxmoxOVZ', '[S] ProxmoxOVZ'), ('uWSGIPythonController', '[S] Python uWSGI'), ('StaticController', '[S] Static'), ('SymbolicLinkController', '[S] Symbolic link webapp'), ('SyncBind9MasterDomainController', '[S] Sync Bind9 master domain'), ('SyncBind9SlaveDomainController', '[S] Sync Bind9 slave domain'), ('UNIXUserMaildirController', '[S] UNIX maildir user'), ('UNIXUserController', '[S] UNIX user'), ('WebalizerAppController', '[S] Webalizer App'), ('WebalizerController', '[S] Webalizer Content'), ('WordPressURLController', '[S] WordPress URL'), ('WordPressController', '[S] Wordpress'), ('WordpressMuController', '[S] Wordpress multisite'), ('OwnCloudController', '[S] ownCloud SaaS'), ('PhpListSaaSController', '[S] phpList SaaS')], max_length=256, verbose_name='backend'),
),
migrations.AlterField(
model_name='server',

View file

@ -7,7 +7,7 @@ from orchestra.contrib.orchestration import ServiceController, replace
from .. import settings
class BSCWBackend(ServiceController):
class BSCWController(ServiceController):
verbose_name = _("BSCW SaaS")
model = 'saas.SaaS'
default_route_match = "saas.service == 'bscw'"

View file

@ -12,7 +12,7 @@ from . import ApacheTrafficByHost
from .. import settings
class DokuWikiMuBackend(ServiceController):
class DokuWikiMuController(ServiceController):
"""
Creates a DokuWiki site on a DokuWiki multisite installation.
"""
@ -79,7 +79,7 @@ class DokuWikiMuBackend(ServiceController):
)
def get_context(self, saas):
context = super(DokuWikiMuBackend, self).get_context(saas)
context = super(DokuWikiMuController, self).get_context(saas)
domain = saas.get_site_domain()
context.update({
'template': settings.SAAS_DOKUWIKI_TEMPLATE_PATH,

View file

@ -8,7 +8,7 @@ from orchestra.contrib.orchestration import ServiceController, replace
from .. import settings
class DrupalMuBackend(ServiceController):
class DrupalMuController(ServiceController):
"""
Creates a Drupal site on a Drupal multisite installation
"""
@ -38,7 +38,7 @@ class DrupalMuBackend(ServiceController):
self.append("rm -fr %(app_path)s" % context)
def get_context(self, webapp):
context = super(DrupalMuBackend, self).get_context(webapp)
context = super(DrupalMuController, self).get_context(webapp)
context['drupal_path'] = settings.SAAS_DRUPAL_SITES_PATH % context
context['drupal_settings'] = os.path.join(context['drupal_path'], 'settings.php')
return replace(context, "'", '"')

View file

@ -8,7 +8,7 @@ from orchestra.contrib.orchestration import ServiceController
from .. import settings
class GitLabSaaSBackend(ServiceController):
class GitLabSaaSController(ServiceController):
verbose_name = _("GitLab SaaS")
model = 'saas.SaaS'
default_route_match = "saas.service == 'gitlab'"

View file

@ -8,7 +8,7 @@ from orchestra.contrib.orchestration import ServiceController
from .. import settings
class MoodleMuBackend(ServiceController):
class MoodleMuController(ServiceController):
"""
Creates a Moodle site on a Moodle multisite installation

View file

@ -94,7 +94,7 @@ class OwnClouwAPIMixin(object):
return ret
class OwnCloudBackend(OwnClouwAPIMixin, ServiceController):
class OwnCloudController(OwnClouwAPIMixin, ServiceController):
"""
Creates a wordpress site on a WordPress MultiSite installation.

View file

@ -13,7 +13,7 @@ from orchestra.utils.sys import sshrun
from .. import settings
class PhpListSaaSBackend(ServiceController):
class PhpListSaaSController(ServiceController):
"""
Creates a new phplist instance on a phpList multisite installation.
The site is created by means of creating a new database per phpList site,

View file

@ -12,7 +12,7 @@ from . import ApacheTrafficByHost
from .. import settings
class WordpressMuBackend(ServiceController):
class WordpressMuController(ServiceController):
"""
Creates a wordpress site on a WordPress MultiSite installation.

View file

@ -10,7 +10,7 @@ from orchestra.contrib.resources import ServiceMonitor
from . import settings
class UNIXUserBackend(ServiceController):
class UNIXUserController(ServiceController):
"""
Basic UNIX system user/group support based on <tt>useradd</tt>, <tt>usermod</tt>, <tt>userdel</tt> and <tt>groupdel</tt>.
Autodetects and uses ACL if available, for better permission management.

View file

@ -10,7 +10,7 @@ from .. import settings
from . import WebAppServiceMixin
class MoodleBackend(WebAppServiceMixin, ServiceController):
class MoodleController(WebAppServiceMixin, ServiceController):
"""
Installs the latest version of Moodle available on download.moodle.org
"""
@ -92,7 +92,7 @@ class MoodleBackend(WebAppServiceMixin, ServiceController):
)
def get_context(self, webapp):
context = super(MoodleBackend, self).get_context(webapp)
context = super(MoodleController, self).get_context(webapp)
contents = webapp.content_set.all()
context.update({
'db_type': 'mysqli',

View file

@ -11,7 +11,7 @@ from . import WebAppServiceMixin
from .. import settings, utils
class PHPBackend(WebAppServiceMixin, ServiceController):
class PHPController(WebAppServiceMixin, ServiceController):
"""
PHP support for apache-mod-fcgid and php-fpm.
It handles switching between these two PHP process management systemes.
@ -139,13 +139,13 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
self.append("rm -f %(cmd_options_path)s" % context_copy)
def prepare(self):
super(PHPBackend, self).prepare()
super(PHPController, self).prepare()
self.append(textwrap.dedent("""
BACKEND="PHPBackend"
BACKEND="PHPController"
echo "$BACKEND" >> /dev/shm/reload.apache2
function coordinate_apache_reload () {
# Coordinate Apache reload with other concurrent backends (e.g. Apache2Backend)
# Coordinate Apache reload with other concurrent backends (e.g. Apache2Controller)
is_last=0
counter=0
while ! mv /dev/shm/reload.apache2 /dev/shm/reload.apache2.locked; do
@ -193,7 +193,7 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
coordinate_apache_reload
""") % context
)
super(PHPBackend, self).commit()
super(PHPController, self).commit()
def get_fpm_config(self, webapp, context):
options = webapp.type_instance.get_options()

View file

@ -9,7 +9,7 @@ from . import WebAppServiceMixin
from .. import settings
class uWSGIPythonBackend(WebAppServiceMixin, ServiceController):
class uWSGIPythonController(WebAppServiceMixin, ServiceController):
"""
<a href="http://uwsgi-docs.readthedocs.org/en/latest/Emperor.html">Emperor mode</a>
"""
@ -72,7 +72,7 @@ class uWSGIPythonBackend(WebAppServiceMixin, ServiceController):
return context
def get_context(self, webapp):
context = super(PHPBackend, self).get_context(webapp)
context = super(PHPController, self).get_context(webapp)
options = webapp.get_options()
context.update({
'python_version': webapp.type_instance.get_python_version(),

View file

@ -5,7 +5,7 @@ from orchestra.contrib.orchestration import ServiceController
from . import WebAppServiceMixin
class StaticBackend(WebAppServiceMixin, ServiceController):
class StaticController(WebAppServiceMixin, ServiceController):
"""
Static web pages.
Only creates the webapp dir and leaves the web server the decision to execute CGIs or not.

View file

@ -4,12 +4,12 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.contrib.orchestration import ServiceController, replace
from .php import PHPBackend
from .php import PHPController
class SymbolicLinkBackend(PHPBackend, ServiceController):
class SymbolicLinkController(PHPController, ServiceController):
"""
Same as PHPBackend but allows you to have the webapps on a directory diferent than the webapps dir.
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'
@ -28,7 +28,7 @@ class SymbolicLinkBackend(PHPBackend, ServiceController):
pass
def get_context(self, webapp):
context = super(SymbolicLinkBackend, self).get_context(webapp)
context = super(SymbolicLinkController, self).get_context(webapp)
context.update({
'link_path': webapp.data['path'],
})

View file

@ -6,7 +6,7 @@ from . import WebAppServiceMixin
# TODO DEPRECATE
class WebalizerAppBackend(WebAppServiceMixin, ServiceController):
class WebalizerAppController(WebAppServiceMixin, ServiceController):
"""
Needed for cleaning up webalizer main folder when webapp deleteion withou related contents
"""

View file

@ -11,7 +11,7 @@ from . import WebAppServiceMixin
# Based on https://github.com/mtomic/wordpress-install/blob/master/wpinstall.php
class WordPressBackend(WebAppServiceMixin, ServiceController):
class WordPressController(WebAppServiceMixin, ServiceController):
"""
Installs the latest version of WordPress available on www.wordpress.org
It fully configures the wp-config.php (keys included) and sets up the database with initial admin password.
@ -135,7 +135,7 @@ class WordPressBackend(WebAppServiceMixin, ServiceController):
self.append("exc('rm -rf %(app_path)s');" % context)
def get_context(self, webapp):
context = super(WordPressBackend, self).get_context(webapp)
context = super(WordPressController, self).get_context(webapp)
context.update({
'db_name': webapp.data['db_name'],
'db_user': webapp.data['db_user'],

View file

@ -53,7 +53,7 @@ class WebAppMixin(object):
class StaticWebAppMixin(object):
backend = backends.static.StaticBackend
backend = backends.static.StaticController
type_value = 'static'
token = random_ascii(100)
page = (

View file

@ -12,7 +12,7 @@ from .. import settings
from ..utils import normurlpath
class Apache2Backend(ServiceController):
class Apache2Controller(ServiceController):
"""
Apache &ge;2.4 backend with support for the following directives:
<tt>static</tt>, <tt>location</tt>, <tt>fpm</tt>, <tt>fcgid</tt>, <tt>uwsgi</tt>, \
@ -142,14 +142,14 @@ class Apache2Backend(ServiceController):
)
def prepare(self):
super(Apache2Backend, self).prepare()
super(Apache2Controller, self).prepare()
# Coordinate apache restart with php backend in order not to overdo it
self.append(textwrap.dedent("""
BACKEND="Apache2Backend"
BACKEND="Apache2Controller"
echo "$BACKEND" >> /dev/shm/restart.apache2
function coordinate_apache_reload () {
# Coordinate Apache reload with other concurrent backends (e.g. PHPBackend)
# Coordinate Apache reload with other concurrent backends (e.g. PHPController)
is_last=0
counter=0
while ! mv /dev/shm/reload.apache2 /dev/shm/reload.apache2.locked; do
@ -188,7 +188,7 @@ class Apache2Backend(ServiceController):
def commit(self):
""" reload Apache2 if necessary """
self.append("coordinate_apache_reload")
super(Apache2Backend, self).commit()
super(Apache2Controller, self).commit()
def get_directives(self, directive, context):
method, args = directive[0], directive[1:]

View file

@ -3,7 +3,7 @@ import textwrap
from orchestra.contrib.orchestration import ServiceController
class MoodleWWWRootBackend(ServiceController):
class MoodleWWWRootController(ServiceController):
"""
Configures Moodle site WWWRoot, without it Moodle refuses to work.
"""

View file

@ -8,7 +8,7 @@ from orchestra.contrib.orchestration import ServiceController
from .. import settings
class WebalizerBackend(ServiceController):
class WebalizerController(ServiceController):
"""
Creates webalizer conf file for each time a webalizer webapp is mounted on a website.
"""

View file

@ -3,7 +3,7 @@ import textwrap
from orchestra.contrib.orchestration import ServiceController
class WordPressURLBackend(ServiceController):
class WordPressURLController(ServiceController):
"""
Configures WordPress site URL with associated website domain.
"""

View file

@ -4,7 +4,7 @@ import socket
import requests
from orchestra.contrib.domains.models import Domain, Record
from orchestra.contrib.domains.backends import Bind9MasterDomainBackend
from orchestra.contrib.domains.backends import Bind9MasterDomainController
from orchestra.contrib.orchestration.models import Server, Route
from orchestra.contrib.webapps.tests.functional_tests.tests import StaticWebAppMixin, RESTWebAppMixin, WebAppMixin, PHPFcidWebAppMixin, PHPFPMWebAppMixin
from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, save_response_on_error
@ -26,9 +26,9 @@ class WebsiteMixin(WebAppMixin):
def add_route(self):
super(WebsiteMixin, self).add_route()
server = Server.objects.get()
backend = backends.apache.Apache2Backend.get_name()
backend = backends.apache.Apache2Controller.get_name()
Route.objects.get_or_create(backend=backend, match=True, host=server)
backend = Bind9MasterDomainBackend.get_name()
backend = Bind9MasterDomainController.get_name()
Route.objects.get_or_create(backend=backend, match=True, host=server)
def validate_add_website(self, name, domain):