コード例 #1
0
#
# You should have received a copy of the GNU Affero General Public
# License with the Debian GNU/Linux or Univention distribution in file
# /usr/share/common-licenses/AGPL-3; if not, see
# <http://www.gnu.org/licenses/>.

import os
import univention.info_tools as uit
from univention.management.console import Translation
from univention.management.console.base import Base
from univention.management.console.modules.decorators import sanitize, allow_get_request
from univention.management.console.modules.sanitizers import ChoicesSanitizer
from univention.management.console.modules import UMC_Error
from univention.management.console.log import MODULE

_ = Translation('univention-management-console-modules-mrtg').translate

# Teststring zum Wiederfinden


class Instance(Base):
    @allow_get_request
    @sanitize(filename=ChoicesSanitizer(choices=[
        'ucs_0load-day.png', 'ucs_0load-year.png', 'ucs_2mem-week.png',
        'ucs_3swap-month.png', 'ucs_0load-month.png', 'ucs_2mem-day.png',
        'ucs_2mem-year.png', 'ucs_3swap-week.png', 'ucs_0load-week.png',
        'ucs_2mem-month.png', 'ucs_3swap-day.png', 'ucs_3swap-year.png'
    ],
                                        required=True))
    def get_statistic(self, request):
        path = '/usr/share/univention-maintenance/'
コード例 #2
0
# <http://www.gnu.org/licenses/>.

import notifier
import notifier.threads

from univention.management.console import Translation
from univention.management.console.base import Base, UMC_Error
from univention.management.console.config import ucr
from univention.management.console.log import MODULE
from univention.management.console.modules.decorators import simple_response, sanitize
from univention.management.console.modules.sanitizers import PatternSanitizer, StringSanitizer

from univention.service_info import ServiceInfo, ServiceError
import univention.config_registry

_ = Translation('univention-management-console-module-services').translate


class Instance(Base):
    @sanitize(pattern=PatternSanitizer(default='.*'))
    @simple_response
    def query(self, pattern):
        ucr.load()
        srvs = ServiceInfo()

        lang = _.im_self.locale.language
        if lang in (None, 'C'):
            lang = 'en'

        result = []
        for name, srv in srvs.services.items():
コード例 #3
0
from __future__ import absolute_import

import notifier
import notifier.threads

from univention.lib import fstab
from univention.management.console import Translation
from univention.management.console.log import MODULE
from univention.management.console.base import UMC_Error
from univention.management.console.modules.decorators import sanitize
from univention.management.console.modules.sanitizers import StringSanitizer, IntegerSanitizer, PatternSanitizer

from . import mtab
from . import tools

_ = Translation('univention-management-console-module-quota').translate


class LimitSanitizer(IntegerSanitizer):

	def _sanitize(self, value, name, further_arguments):
		if not value:
			return self.default
		return super(LimitSanitizer, self)._sanitize(value, name, further_arguments)


class Commands(object):

	@sanitize(
		partitionDevice=StringSanitizer(required=True),
		filter=PatternSanitizer(default='.*'),
コード例 #4
0
# /usr/share/common-licenses/AGPL-3; if not, see
# <http://www.gnu.org/licenses/>.

import pgdb

from univention.management.console import Translation
from univention.management.console.modules import Base, UMC_Error
import univention.config_registry
import univention.pkgdb as updb

from univention.management.console.log import MODULE

from univention.management.console.modules.decorators import simple_response, log, sanitize
from univention.management.console.modules.sanitizers import ChoicesSanitizer

_ = Translation('univention-management-console-module-pkgdb').translate

RECORD_LIMIT = 100000  # never return more than this many records

CRITERIA = {
	'systems': [
		'all_properties', 'sysname', 'sysrole', 'sysversion', 'sysversion_greater', 'sysversion_lower'
	],
	'packages': [
		'pkgname', 'currentstate',  # head fields
		'selectedstate', 'inststate',  # state fields
	]
}

CRITERIA_OPERATOR = {
	'sysname': '~',