websites complete fusion
This commit is contained in:
parent
4368b40d00
commit
708bbb3a3f
|
@ -60,7 +60,7 @@ class ContentInline(AccountAdminMixin, admin.TabularInline):
|
|||
|
||||
class WebsiteAdmin(SelectAccountAdminMixin, ExtendedModelAdmin):
|
||||
list_display = (
|
||||
'name', 'display_domains', 'display_webapps', 'account_link', 'display_active'
|
||||
'name', 'display_domains', 'display_webapps', 'account_link', 'target_server', 'display_active'
|
||||
)
|
||||
list_filter = (
|
||||
'protocol', IsActiveListFilter, HasWebAppsListFilter, HasDomainsFilter
|
||||
|
|
|
@ -4,6 +4,7 @@ import textwrap
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from orchestra.contrib.orchestration import ServiceController
|
||||
from orchestra.settings import NEW_SERVERS
|
||||
|
||||
from .. import settings
|
||||
|
||||
|
@ -29,7 +30,8 @@ class WebalizerController(ServiceController):
|
|||
cat << 'EOF' > %(webalizer_conf_path)s
|
||||
%(webalizer_conf)s
|
||||
EOF
|
||||
chown %(user)s:www-data %(webalizer_path)s
|
||||
# chown %(user)s:www-data %(webalizer_path)s
|
||||
chown www-data:www-data %(webalizer_path)s
|
||||
chmod g+xr %(webalizer_path)s
|
||||
""") % context
|
||||
)
|
||||
|
@ -54,17 +56,34 @@ class WebalizerController(ServiceController):
|
|||
'webalizer_conf_path': os.path.join(settings.WEBSITES_WEBALIZER_PATH, conf_file),
|
||||
'user': content.webapp.account.username,
|
||||
'banner': self.get_banner(),
|
||||
'target_server': content.website.target_server,
|
||||
}
|
||||
context['webalizer_conf'] = textwrap.dedent("""\
|
||||
# %(banner)s
|
||||
LogFile %(site_logs)s
|
||||
LogType clf
|
||||
OutputDir %(webalizer_path)s
|
||||
HistoryName webalizer.hist
|
||||
Incremental yes
|
||||
IncrementalName webalizer.current
|
||||
ReportTitle Stats of
|
||||
HostName %(site_name)s
|
||||
if context.get('target_server').name in NEW_SERVERS:
|
||||
context['webalizer_conf'] = textwrap.dedent("""\
|
||||
# %(banner)s
|
||||
LogFile %(site_logs)s
|
||||
LogType clf
|
||||
OutputDir %(webalizer_path)s
|
||||
HistoryName awffull.hist
|
||||
Incremental yes
|
||||
IncrementalName awffull.current
|
||||
ReportTitle Stats of
|
||||
HostName %(site_name)s
|
||||
""") % context
|
||||
else:
|
||||
context['webalizer_conf'] = textwrap.dedent("""\
|
||||
# %(banner)s
|
||||
LogFile %(site_logs)s
|
||||
LogType clf
|
||||
OutputDir %(webalizer_path)s
|
||||
HistoryName webalizer.hist
|
||||
Incremental yes
|
||||
IncrementalName webalizer.current
|
||||
ReportTitle Stats of
|
||||
HostName %(site_name)s
|
||||
""") % context
|
||||
|
||||
context['webalizer_conf'] = context['webalizer_conf'] + textwrap.dedent("""\
|
||||
|
||||
PageType htm*
|
||||
PageType php*
|
||||
|
@ -85,19 +104,27 @@ class WebalizerController(ServiceController):
|
|||
|
||||
IncludeURL *
|
||||
|
||||
SearchEngine yahoo.com p=
|
||||
SearchEngine altavista.com q=
|
||||
SearchEngine google.com q=
|
||||
SearchEngine eureka.com q=
|
||||
SearchEngine lycos.com query=
|
||||
SearchEngine hotbot.com MT=
|
||||
SearchEngine msn.com MT=
|
||||
SearchEngine infoseek.com qt=
|
||||
SearchEngine webcrawler searchText=
|
||||
SearchEngine excite search=
|
||||
SearchEngine netscape.com search=
|
||||
SearchEngine mamma.com query=
|
||||
SearchEngine alltheweb.com query=
|
||||
SearchEngine google. q=
|
||||
SearchEngine yahoo. p=
|
||||
SearchEngine msn. q=
|
||||
SearchEngine search.aol query=
|
||||
SearchEngine altavista. q=
|
||||
SearchEngine lycos. query=
|
||||
SearchEngine hotbot. query=
|
||||
SearchEngine alltheweb. query=
|
||||
SearchEngine infoseek. qt=
|
||||
SearchEngine webcrawler searchText=
|
||||
SearchEngine excite search=
|
||||
SearchEngine netscape. query=
|
||||
SearchEngine ask.com q=
|
||||
SearchEngine webwombat. ix=
|
||||
SearchEngine earthlink. q=
|
||||
SearchEngine search.comcast. q=
|
||||
SearchEngine search.mywebsearch. searchfor=
|
||||
SearchEngine reference.com q=
|
||||
SearchEngine mamma.com query=
|
||||
# Last attempt catch all
|
||||
SearchEngine search. q=
|
||||
|
||||
DumpSites yes""") % context
|
||||
return context
|
||||
|
|
|
@ -3,6 +3,8 @@ from collections import defaultdict
|
|||
from django import forms
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
from orchestra.contrib.webapps.models import WebApp
|
||||
|
||||
from .utils import normurlpath
|
||||
from .validators import validate_domain_protocol, validate_server_name
|
||||
|
||||
|
@ -27,6 +29,25 @@ class WebsiteAdminForm(forms.ModelForm):
|
|||
self.add_error('domains', err)
|
||||
return self.cleaned_data
|
||||
|
||||
def clean_target_server(self):
|
||||
# valida que el webapp pertenezca al server indicado
|
||||
try:
|
||||
server = self.cleaned_data['target_server']
|
||||
except:
|
||||
server = self.instance.target_server
|
||||
|
||||
diferentServer = False
|
||||
for i in range(int(self.data['content_set-TOTAL_FORMS']) + 1):
|
||||
if f"content_set-{i}-webapp" in self.data.keys() and f"content_set-{i}-DELETE" not in self.data.keys():
|
||||
if self.data[f"content_set-{i}-webapp"]:
|
||||
idWebapp = self.data[f"content_set-{i}-webapp"]
|
||||
webapp = WebApp.objects.get(id=idWebapp)
|
||||
if webapp.target_server.id != server.id :
|
||||
diferentServer = True
|
||||
if diferentServer:
|
||||
self.add_error("target_server", f"Some Webapp does not belong to the {server.name} server")
|
||||
return server
|
||||
|
||||
|
||||
class WebsiteDirectiveInlineFormSet(forms.models.BaseInlineFormSet):
|
||||
def clean(self):
|
||||
|
|
Loading…
Reference in a new issue