View | Details | Raw Unified | Return to bug 33527
Collapse All | Expand All

(-)a/ucs-4.0-0/management/univention-management-console-module-udm/umc/python/udm/__init__.py (-4 / +7 lines)
 Lines 50-56   from univention.management.console.modules import Base, UMC_OptionTypeError, UMC Link Here 
50
from univention.management.console.modules.decorators import simple_response, sanitize, multi_response
50
from univention.management.console.modules.decorators import simple_response, sanitize, multi_response
51
from univention.management.console.modules.sanitizers import (
51
from univention.management.console.modules.sanitizers import (
52
	LDAPSearchSanitizer, EmailSanitizer, ChoicesSanitizer,
52
	LDAPSearchSanitizer, EmailSanitizer, ChoicesSanitizer,
53
	ListSanitizer, StringSanitizer, DictSanitizer
53
	ListSanitizer, StringSanitizer, DictSanitizer, BooleanSanitizer
54
)
54
)
55
from univention.management.console.modules.mixins import ProgressMixin
55
from univention.management.console.modules.mixins import ProgressMixin
56
from univention.management.console.log import MODULE
56
from univention.management.console.log import MODULE
 Lines 644-649   class Instance(Base, ProgressMixin): Link Here 
644
			result = module.get_default_values(property_name)
644
			result = module.get_default_values(property_name)
645
		self.finished(request.id, result)
645
		self.finished(request.id, result)
646
646
647
	@sanitize(
648
		networkDN=StringSanitizer(required=True),
649
		increaseCounter=BooleanSanitizer(default=False)
650
	)
647
	def network(self, request):
651
	def network(self, request):
648
		"""Returns the next IP configuration based on the given network object
652
		"""Returns the next IP configuration based on the given network object
649
653
 Lines 653-664   class Instance(Base, ProgressMixin): Link Here 
653
657
654
		return: {}
658
		return: {}
655
		"""
659
		"""
656
		self.required_options(request, 'networkDN')
657
		module = self._get_module('networks/network')
660
		module = self._get_module('networks/network')
658
		obj = module.get(request.options['networkDN'])
661
		obj = module.get(request.options['networkDN'])
659
662
660
		if not obj:
663
		if not obj:
661
			raise UMC_OptionTypeError('Could not find network object')
664
			raise ObjectDoesNotExists(request.options['networkDN'])
662
		try:
665
		try:
663
			obj.refreshNextIp()
666
			obj.refreshNextIp()
664
		except udm_errors.nextFreeIp:
667
		except udm_errors.nextFreeIp:
 Lines 667-673   class Instance(Base, ProgressMixin): Link Here 
667
		result = {'ip': obj['nextIp'], 'dnsEntryZoneForward': obj['dnsEntryZoneForward'], 'dhcpEntryZone': obj['dhcpEntryZone'], 'dnsEntryZoneReverse': obj['dnsEntryZoneReverse']}
670
		result = {'ip': obj['nextIp'], 'dnsEntryZoneForward': obj['dnsEntryZoneForward'], 'dhcpEntryZone': obj['dhcpEntryZone'], 'dnsEntryZoneReverse': obj['dnsEntryZoneReverse']}
668
		self.finished(request.id, result)
671
		self.finished(request.id, result)
669
672
670
		if request.options.get('increaseCounter', False) == True:
673
		if request.options['increaseCounter']:
671
			# increase the next free IP address
674
			# increase the next free IP address
672
			obj.stepIp()
675
			obj.stepIp()
673
			obj.modify()
676
			obj.modify()
(-)a/ucs-4.0-0/management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py (-8 / +9 lines)
 Lines 266-284   class SuperordinateDoesNotExists(ObjectDoesNotExists): Link Here 
266
			yield _('Superordinate %s could not be found.') % (self.ldap_dn,)
266
			yield _('Superordinate %s could not be found.') % (self.ldap_dn,)
267
			yield _('It possibly has been deleted or moved. Please update your search results and open the object again.')
267
			yield _('It possibly has been deleted or moved. Please update your search results and open the object again.')
268
268
269
269
class NoIpLeft(UMCError):
270
class NoIpLeft(UMCError):
270
271
271
	def __init__(self, networkDN):
272
	def __init__(self, ldap_dn):
272
		self.networkName = (udm.uldap.explodeDn(networkDN)[0]).split('=')[1]
273
		try:
274
			self.network_name = udm.uldap.explodeDn(ldap_dn, True)[0]
275
		except IndexError:
276
			self.network_name = ldap_dn
273
		super(NoIpLeft, self).__init__()
277
		super(NoIpLeft, self).__init__()
274
	
278
	
275
	def _error_msg(self):
279
	def _error_msg(self):
276
280
		yield _('Failed to automatically assign an IP address.')
277
			yield _('Failed to automatically assign an IP address.')
281
		yield _('All IP addresses in the specified network "%s" are already in use.') % (self.network_name,)
278
			yield _('All IP addresses in the specified network "%s" are already in use.') % (self.networkName,)
282
		yield _('Please specify a different network or make sure that free IP addresses are available.')
279
			yield _('Please specify a different network or make sure that free IP addresses are available.')
280
281
282
283
283
284
284
class UDM_Error(Exception):
285
class UDM_Error(Exception):

Return to bug 33527