commit a4178313f1cddb0b9a20cd669432d348337bbfb5 Author: Florian Best Date: Tue Jan 6 14:40:55 2015 +0100 remove unused UMCP statistics command diff --git a/ucs-4.0-0/management/univention-management-console/doc/core_api.rst b/ucs-4.0-0/management/univention-management-console/doc/core_api.rst index 11cf848..fe18c77 100644 --- a/ucs-4.0-0/management/univention-management-console/doc/core_api.rst +++ b/ucs-4.0-0/management/univention-management-console/doc/core_api.rst @@ -53,13 +53,3 @@ Helper functions :members: :undoc-members: :show-inheritance: - ----------- -Statistics ----------- - -.. automodule:: univention.management.console.statistics - :members: - :undoc-members: - :show-inheritance: - diff --git a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/definitions.py b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/definitions.py index dcf6199..b83aff1 100644 --- a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/definitions.py +++ b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/definitions.py @@ -70,10 +70,6 @@ COMMANDS = ( CommandDefinition('VERSION', False), CommandDefinition('GET', True), CommandDefinition('SET', True), - CommandDefinition('CLOSE', False), - CommandDefinition('STATISTICS', False), - CommandDefinition('CANCEL', False, 'ids'), - CommandDefinition('STATUS', False, 'ids'), CommandDefinition('EXIT', True), CommandDefinition('UPLOAD', True), ) diff --git a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/server.py b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/server.py index 40a60f0..aecf9dc 100644 --- a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/server.py +++ b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/server.py @@ -39,7 +39,6 @@ Defines the basic class for an UMC server. import fcntl import gzip import os -import pwd import re import socket @@ -65,7 +64,6 @@ from .definitions import ( from ..resources import moduleManager, categoryManager from ..log import CORE, CRYPT, RESOURCES from ..config import ucr, SERVER_MAX_CONNECTIONS -from ..statistics import statistics class MagicBucket(object): @@ -93,7 +91,6 @@ class MagicBucket(object): state.signal_connect('authenticated', self._authenticated) self.__states[socket] = state notifier.socket_add(socket, self._receive) - statistics.connections.new() def exit(self): '''Closes all open connections.''' @@ -103,7 +100,6 @@ class MagicBucket(object): if state.processor is not None: state.processor.shutdown() notifier.socket_remove(sock) - statistics.connections.inactive() # delete states for state in self.__states.values(): del state @@ -119,8 +115,6 @@ class MagicBucket(object): state.authResponse.status = result.status if result.message: state.authResponse.message = result.message - if result: - statistics.users.add(state.username) state.authenticated = bool(result) self._response(state.authResponse, state) state.authResponse = None @@ -198,7 +192,6 @@ class MagicBucket(object): All other valid commands are redirected to the processor. """ state.requests[msg.id] = msg - statistics.requests.new() CORE.info('Incoming request of type %s' % msg.command) if not state.authenticated and msg.command != 'AUTH': res = Response(msg) @@ -255,19 +248,6 @@ class MagicBucket(object): pass self._response(response, state) - elif msg.command == 'STATISTICS': - response = Response(msg) - try: - pwent = pwd.getpwnam(state.username) - if not pwent.pw_uid in (0, ): - raise KeyError - CORE.info('Sending statistic data to client') - response.status = SUCCESS - response.result = statistics.json() - except KeyError: - CORE.info('User not allowed to retrieve statistics') - response.status = BAD_REQUEST_FORBIDDEN - self._response(response, state) else: # inform processor if not state.processor: @@ -307,7 +287,6 @@ class MagicBucket(object): return try: - statistics.requests.inactive() data = str(msg) # there is no data from another request in the send queue if not state.resend_queue: @@ -338,10 +317,6 @@ class MagicBucket(object): if socket not in self.__states: return - statistics.connections.inactive() - if self.__states[socket].username in statistics.users: - statistics.users.remove(self.__states[socket].username) - if self.__states[socket].processor is not None: self.__states[socket].processor.shutdown() diff --git a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/session.py b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/session.py index 2fed8e4..b04fd41 100644 --- a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/session.py +++ b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/session.py @@ -306,8 +306,6 @@ class Processor(signals.Provider): self.handle_request_command(msg) elif msg.command == 'UPLOAD': self.handle_request_upload(msg) - elif msg.command in ('STATUS', 'CANCEL', 'CLOSE'): - self.handle_request_unknown(msg) else: self.handle_request_unknown(msg) diff --git a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/statistics.py b/ucs-4.0-0/management/univention-management-console/src/univention/management/console/statistics.py deleted file mode 100644 index 249590c..0000000 --- a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/statistics.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Univention Management Console -# runtime statistics of the UMC server -# -# Copyright 2011-2014 Univention GmbH -# -# http://www.univention.de/ -# -# All rights reserved. -# -# The source code of this program is made available -# under the terms of the GNU Affero General Public License version 3 -# (GNU AGPL V3) as published by the Free Software Foundation. -# -# Binary versions of this program provided by Univention to you as -# well as other copyrighted, protected or trademarked materials like -# Logos, graphics, fonts, specific documentations and configurations, -# cryptographic keys etc. are subject to a license agreement between -# you and Univention and not subject to the GNU AGPL V3. -# -# In the case you use this program under the terms of the GNU AGPL V3, -# the program is provided in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# 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 -# . - - -class Counter(object): - - """Implements a counter that counts available elements of - any type that can be inactive.""" - - def __init__(self): - self._all = 0l - self._active = 0l - - def new(self): - """Increase counter by one active element""" - self._all += 1 - self._active += 1 - - def inactive(self): - """Decrease counter of active elements by one""" - self._active -= 1 - - def json(self): - """Returns counter information in JSON compatible form""" - return {'all': self._all, 'active': self._active} - - -class Statistics(object): - - """Collects information about the connections, modules, requests and - users processed and seen by the running UMC server instance""" - connections = Counter() - modules = Counter() - requests = Counter() - users = set() - - @staticmethod - def json(): - """Returns the statistics ina JSON compatible form""" - return { - 'connections': Statistics.connections.json(), - 'modules': Statistics.modules.json(), - 'requests': Statistics.requests.json(), - 'users': list(Statistics.users) - } - -#: global :class:`Statistics` object -statistics = Statistics()