euscanwww: Adding make.conf and overlays info to config page

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-11-02 20:10:06 +01:00
parent 4751eaf7a5
commit c04b4c8187
4 changed files with 62 additions and 9 deletions

View File

@ -4,6 +4,11 @@ djeuscan.helpers
from distutils.version import StrictVersion, LooseVersion from distutils.version import StrictVersion, LooseVersion
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.conf import settings
from layman import Layman
from portage.util import getconfig
def xint(i): def xint(i):
@ -83,3 +88,13 @@ def get_maintainer_or_404(id=None, email=None):
return get_object_or_404(Maintainer, pk=id) return get_object_or_404(Maintainer, pk=id)
else: else:
return get_object_or_404(Maintainer, email=email) return get_object_or_404(Maintainer, email=email)
def get_make_conf():
return getconfig(settings.MAKE_CONF, tolerant=1, allow_sourcing=True)
def get_layman_repos():
lay = Layman(config=settings.LAYMAN_CONFIG)
installed_overlays = lay.get_installed()
return lay.get_all_info(installed_overlays)

View File

@ -3,11 +3,40 @@
{% block content %} {% block content %}
<h2>Server configuration</h2> <h2>Server configuration</h2>
<table class="table table-bordered">
<caption>
<h4 class="padded">make.conf</h4>
</caption>
{% for key, value in make_conf.items %}
<tr>
<td><b>{{ key }}</b></td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</table>
<hr />
<table class="table table-bordered">
<caption>
<h4 class="padded">Available overlays</h4>
</caption>
{% for key, value in layman_repos.items %}
<tr>
<td><b><a href="{{ value.homepage }}">{{ key }}</a></b></td>
<td>{{ value.description }}</td>
</tr>
{% endfor %}
</table>
<hr />
<table class="table table-bordered"> <table class="table table-bordered">
<caption> <caption>
<h4 class="padded">Euscan config</h4> <h4 class="padded">Euscan config</h4>
</caption> </caption>
{% for key, value in CONFIG.items %} {% for key, value in euscan_config.CONFIG.items %}
<tr> <tr>
<td><b>{{ key }}</b></td> <td><b>{{ key }}</b></td>
<td>{{ value }}</td> <td>{{ value }}</td>
@ -21,7 +50,7 @@
<caption> <caption>
<h4 class="padded">Versions blacklist</h4> <h4 class="padded">Versions blacklist</h4>
</caption> </caption>
{% for item in BLACKLIST_VERSIONS %} {% for item in euscan_config.BLACKLIST_VERSIONS %}
<tr> <tr>
<td>{{ item }}</td> <td>{{ item }}</td>
</tr> </tr>
@ -34,7 +63,7 @@
<caption> <caption>
<h4 class="padded">Packages blacklist</h4> <h4 class="padded">Packages blacklist</h4>
</caption> </caption>
{% for item in BLACKLIST_PACKAGES %} {% for item in euscan_config.BLACKLIST_PACKAGES %}
<tr> <tr>
<td>{{ item }}</td> <td>{{ item }}</td>
</tr> </tr>
@ -47,7 +76,7 @@
<caption> <caption>
<h4 class="padded">Scandir blacklist</h4> <h4 class="padded">Scandir blacklist</h4>
</caption> </caption>
{% for item in SCANDIR_BLACKLIST_URLS %} {% for item in euscan_config.SCANDIR_BLACKLIST_URLS %}
<tr> <tr>
<td>{{ item }}</td> <td>{{ item }}</td>
</tr> </tr>
@ -60,7 +89,7 @@
<caption> <caption>
<h4 class="padded">Bruteforce packages blacklist</h4> <h4 class="padded">Bruteforce packages blacklist</h4>
</caption> </caption>
{% for item in BRUTEFORCE_BLACKLIST_PACKAGES %} {% for item in euscan_config.BRUTEFORCE_BLACKLIST_PACKAGES %}
<tr> <tr>
<td>{{ item }}</td> <td>{{ item }}</td>
</tr> </tr>
@ -73,7 +102,7 @@
<caption> <caption>
<h4 class="padded">Bruteforce urls blacklist</h4> <h4 class="padded">Bruteforce urls blacklist</h4>
</caption> </caption>
{% for item in BRUTEFORCE_BLACKLIST_URLS %} {% for item in euscan_config.BRUTEFORCE_BLACKLIST_URLS %}
<tr> <tr>
<td>{{ item }}</td> <td>{{ item }}</td>
</tr> </tr>
@ -86,7 +115,7 @@
<caption> <caption>
<h4 class="padded">Robots.txt domain blacklist</h4> <h4 class="padded">Robots.txt domain blacklist</h4>
</caption> </caption>
{% for item in ROBOTS_TXT_BLACKLIST_DOMAINS %} {% for item in euscan_config.ROBOTS_TXT_BLACKLIST_DOMAINS %}
<tr> <tr>
<td>{{ item }}</td> <td>{{ item }}</td>
</tr> </tr>

View File

@ -9,7 +9,7 @@ from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
from djeuscan.helpers import version_key, packages_from_names, \ from djeuscan.helpers import version_key, packages_from_names, \
get_maintainer_or_404 get_maintainer_or_404, get_make_conf, get_layman_repos
from djeuscan.models import Version, Package, Herd, Maintainer, EuscanResult, \ from djeuscan.models import Version, Package, Herd, Maintainer, EuscanResult, \
VersionLog, RefreshPackageQuery, ProblemReport, Category, Overlay VersionLog, RefreshPackageQuery, ProblemReport, Category, Overlay
from djeuscan.forms import WorldForm, PackagesForm, ProblemReportForm from djeuscan.forms import WorldForm, PackagesForm, ProblemReportForm
@ -315,7 +315,7 @@ def config(request):
from euscan import CONFIG, BLACKLIST_VERSIONS, BLACKLIST_PACKAGES, \ from euscan import CONFIG, BLACKLIST_VERSIONS, BLACKLIST_PACKAGES, \
SCANDIR_BLACKLIST_URLS, BRUTEFORCE_BLACKLIST_PACKAGES, \ SCANDIR_BLACKLIST_URLS, BRUTEFORCE_BLACKLIST_PACKAGES, \
BRUTEFORCE_BLACKLIST_URLS, ROBOTS_TXT_BLACKLIST_DOMAINS BRUTEFORCE_BLACKLIST_URLS, ROBOTS_TXT_BLACKLIST_DOMAINS
return { euscan_config = {
"CONFIG": CONFIG, "CONFIG": CONFIG,
"BLACKLIST_VERSIONS": BLACKLIST_VERSIONS, "BLACKLIST_VERSIONS": BLACKLIST_VERSIONS,
"BLACKLIST_PACKAGES": BLACKLIST_PACKAGES, "BLACKLIST_PACKAGES": BLACKLIST_PACKAGES,
@ -324,6 +324,14 @@ def config(request):
"BRUTEFORCE_BLACKLIST_URLS": BRUTEFORCE_BLACKLIST_URLS, "BRUTEFORCE_BLACKLIST_URLS": BRUTEFORCE_BLACKLIST_URLS,
"ROBOTS_TXT_BLACKLIST_DOMAINS": ROBOTS_TXT_BLACKLIST_DOMAINS, "ROBOTS_TXT_BLACKLIST_DOMAINS": ROBOTS_TXT_BLACKLIST_DOMAINS,
} }
make_conf = get_make_conf()
layman_repos = get_layman_repos()
return {
"euscan_config": euscan_config,
"make_conf": make_conf,
"layman_repos": layman_repos,
}
@render_to("euscan/statistics.html") @render_to("euscan/statistics.html")

View File

@ -229,6 +229,7 @@ PORTAGE_ROOT = "/"
PORTAGE_CONFIGROOT = "/" PORTAGE_CONFIGROOT = "/"
EIX_CACHEFILE = os.path.join(PORTAGE_ROOT, 'var/cache/eix') EIX_CACHEFILE = os.path.join(PORTAGE_ROOT, 'var/cache/eix')
LAYMAN_CONFIG = "/etc/layman/layman.cfg" LAYMAN_CONFIG = "/etc/layman/layman.cfg"
MAKE_CONF = "/etc/make.conf"
EGENCACHE_JOBS = 4 EGENCACHE_JOBS = 4