• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python debug.debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中univention.debug.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: cups_quota_user_show

 def cups_quota_user_show(self, object):
     if object.options.get("printer") and object.options.get("user"):
         cb = notifier.Callback(self._cups_quota_user_show_return, object)
         pykota._pykota_get_quota_users([object.options["printer"]], cb)
     else:
         self._cups_quota_user_show_return(0, None, object)
         ud.debug(ud.ADMIN, ud.WARN, "CUPS.quota_user_show: no printer or no user turned over")
开发者ID:m-narayan,项目名称:smart,代码行数:7,代码来源:_printer.py


示例2: license

def license(no, key):
    try:
        enc = b64decode(key)
        raw = ''
        while len(enc) > pbs:
            d, key = (enc[:pbs], enc[pbs:])
            raw = raw + pub.public_decrypt(d, 1)
        if len(enc) != pbs:
            return None		# invalid license
        raw = raw + pub.public_decrypt(enc, 1)
        #
        items = raw.rstrip().split('\n')
        if not items:
            return None		# invalid license
        vdate = int(items.pop(0))
        if date.today().toordinal() > vdate:
            ud.debug(ud.LISTENER, ud.ERROR, '%d License has expired' % no)
            return None		# expired
        l = {'valid': True, 'vdate': vdate} # at least one feature returned
        while items:
            kv = items.pop(0).split('=', 1)
            kv.append(True)
            l[kv[0]] = kv[1]
        return l			# valid license
    except:
        return None			# invalid license
开发者ID:bytemine,项目名称:univention-openvpn,代码行数:26,代码来源:__init__.py


示例3: reload_daemon

def reload_daemon(daemon, prefix):
	script = os.path.join ('/etc/init.d', daemon)
	if os.path.exists(script):
		ud.debug(ud.LISTENER, ud.INFO, "%s %s reload" % (prefix, daemon) )
		listener.run(script, [daemon,'reload'], uid=0)
	else:
		ud.debug(ud.LISTENER, ud.INFO, "%s no %s to reload found" % (prefix, daemon) )
开发者ID:B-Rich,项目名称:smart,代码行数:7,代码来源:cups-printers.py


示例4: maxvpnusers

def maxvpnusers(no, key):
    mnlu = 5
    try:
        return max(int(license(no, key)['u']), mnlu)
    except:
        ud.debug(ud.LISTENER, ud.ERROR, '%d Invalid license' % no)
        return mnlu			# invalid license
开发者ID:bytemine,项目名称:univention-openvpn,代码行数:7,代码来源:__init__.py


示例5: get_object_real

	def get_object_real( self, module, dn ):
		if self._cached.has_key( dn ):
			return self._cached[ dn ]
		if isinstance( module, basestring ):
			if self._modules.has_key( module ):
				module = self._modules[ module ]
			else:
				name = module
				module = ua_modules.get( name )
				ua_modules.init( self._access, self._position, module )
				self._modules[ name ] = module
		elif module == None:
			module = self.identify( dn )
			if not module:
				return None
			ua_modules.init( self._access, self._position, module )
		new = ua_objects.get( module, self._config, self._access, position = self._position, dn = dn )
		# if the object is not valid it should be displayed as an empty object
		try:
			new.open()
		except Exception, e:
			# write the traceback in the logfile
			import traceback
			
			ud.debug( ud.ADMIN, ud.ERROR, 'The object %s could not be opened' % dn )
			try:
				tb = traceback.format_exc().encode( 'ascii', 'replace' ).replace( '%', '?' )
				# this might fail because of problems with univention.debug
				ud.debug( ud.ADMIN, ud.ERROR, 'Traceback: %s' % tb )
			except:
				pass
开发者ID:B-Rich,项目名称:smart,代码行数:31,代码来源:admin.py


示例6: action

	def action( self, object ):
		ud.debug(ud.ADMIN, ud.INFO, 'UVMM.DW.action(current: %s)' % str( self.current ) )
		if self.current is None:
			# read pool
			ud.debug( ud.ADMIN, ud.INFO, 'UVMM.DW.action: node storage pools: %s' % self.node_uri)
			self.set_defaults( object )
		return umcd.IWizard.action( self, object )
开发者ID:B-Rich,项目名称:smart,代码行数:7,代码来源:wizards.py


示例7: _create_type_select_button

	def _create_type_select_button(self, options, items):
		"""Create list to select driver-type allowed by current driver-pool."""
		# FIXME: items are ignored for some unknown reason
		opts = copy.deepcopy(options)
		opts['action'] = 'type-selected'
		action = umcd.Action(umcp.SimpleCommand(self.command, options=opts), items)
		choices = (
				('RAW', _('Simple format (raw)')),
				)
		try:
			pool_name = options['pool-name']
			ud.debug(ud.ADMIN, ud.ALL, 'UVMM.DW.ts(pool-name=%s)' % pool_name)
			if self._is_file_pool(pool_name):
				if self.node_uri.startswith('qemu'):
					choices = (
							#('qcow', _('Extended format (qcow)')),
							('qcow2', _('Extended format (qcow2)')),
							#('vmdk', _('VMWare Disk')),
							('raw', _('Simple format (raw)')),
							)
				elif self.node_uri.startswith('xen'):
					choices = (
							('raw', _('Simple format (raw)')),
							#('qcow2', _('Qemu copy-on-write 2')),
							#('vhd', _('Virtual Hard Disk')),
							#('vmdk', _('VMWare Disk')),
							)
		except LookupError, e:
			ud.debug(ud.ADMIN, ud.ALL, 'UVMM.DW.ts exception=%s' % e)
开发者ID:B-Rich,项目名称:smart,代码行数:29,代码来源:wizards.py


示例8: _pykota_set_quota

def _pykota_set_quota( callback, **kwargs ):
	cmd = '/usr/bin/edpykota '

	# check for boolean arguments
	for arg in [ 'add', 'delete', 'reset', 'hardreset' ]:
		if kwargs.get(arg) == True:
			cmd += '--%s ' % arg

	if kwargs.get('printers'):
		cmd += '--printer %s ' % ','.join(kwargs['printers'])

	if kwargs.get('softlimit'):
		cmd += '-S %s ' % kwargs['softlimit']

	if kwargs.get('hardlimit'):
		cmd += '-H %s ' % kwargs['hardlimit']

	if kwargs.get('lifetimecounter'):
		cmd += '--used %s ' % kwargs['lifetimecounter']

	if kwargs.get('balance'):
		cmd += '--balance %s ' % str(kwargs['balance'])

	if kwargs.get('balance'):
		cmd += '--overcharge %s ' % str(kwargs['balance'])

	if kwargs.get('userlist'):
		cmd += ' %s ' % ' '.join(kwargs['userlist'])

	ud.debug( ud.ADMIN, ud.PROCESS, 'run: %s' % cmd )
	proc = notifier.popen.RunIt( cmd )
	proc.signal_connect( 'finished', callback )
	proc.start()
开发者ID:B-Rich,项目名称:smart,代码行数:33,代码来源:pykota.py


示例9: check_sitetosite

def check_sitetosite(no):
    listener.setuid(0)
    lo = ul.getMachineConnection()

    servers = lo.search('(univentionOpenvpnLicense=*)')

    sitetosite = False
    for server in servers:
        key = server[1].get('univentionOpenvpnLicense', [None])[0]
        try:
            l = license(no, key)
            ud.debug(ud.LISTENER, ud.INFO, '%d Processing license with ID %s:' % (no, l['id']))
            ud.debug(ud.LISTENER, ud.INFO, '%d Valid until: %s' % (no, date.fromordinal(l['vdate'])))
            ud.debug(ud.LISTENER, ud.INFO, '%d Users: %s' % (no, l['u']))
            ud.debug(ud.LISTENER, ud.INFO, '%d Site-2-Site: %s' % (no, l['s2s']))
            if l.get('s2s'): sitetosite = True
            break
        except:
            pass
    listener.unsetuid()
    if not sitetosite:
        ud.debug(ud.LISTENER, ud.INFO, '%d Skipping actions' % no)
        return False
    else:
        return True
开发者ID:bytemine,项目名称:univention-openvpn,代码行数:25,代码来源:__init__.py


示例10: handler

def handler(dn, new, old, cmd):
    ud.debug(ud.LISTENER, ud.INFO, '2 master2 handler')

    if cmd == 'n':
        return

    name = new.get('cn', [None])[0]
    port = new.get('univentionOpenvpnPort', [None])[0]
    addr = new.get('univentionOpenvpnAddress', [None])[0]

    if not name or not port or not addr:
        return

    listener.setuid(0)
    lo = ul.getMachineConnection()
    vpnusers = lo.search('(univentionOpenvpnAccount=1)')

    if not univention_openvpn_common.check_user_count(2):                                                                                                                                                                                 
        return          # do nothing

    for user in vpnusers:
        uid = user[1].get('uid', [None])[0]
        home = user[1].get('homeDirectory', ['/dev/null'])[0]
        ud.debug(ud.LISTENER, ud.INFO, '2 Create new certificate for %s in %s' % (uid, home))

        proto = 'udp6' if addr and addr.count(':') else 'udp'

        if uid and home:
        # update bundle for this openvpn server with new config
            try:
                listener.run('/usr/lib/openvpn-int/create-bundle', ['create-bundle', 'no', uid, home, name, addr, port, proto], uid=0)
            finally:
                listener.unsetuid()

    listener.unsetuid()
开发者ID:bytemine,项目名称:univention-openvpn,代码行数:35,代码来源:openvpn-master2.py


示例11: update_extended_options

def update_extended_options(lo, module, position):
	"""Overwrite options defined via LDAP."""

	# get current language
	lang = locale.getlocale(locale.LC_MESSAGES)[0]
	ud.debug(ud.ADMIN, ud.INFO, 'modules update_extended_options: LANG=%s' % lang)
	if lang:
		lang = lang.replace('_','-').lower()
	else:
		lang = 'xxxxx'

	# append UDM extended options
	for dn, attrs in lo.search(base=position.getDomainConfigBase(), filter='(&(objectClass=univentionUDMOption)(univentionUDMOptionModule=%s))' % name(module)):
		oname = attrs['cn'][0]
		shortdesc = attrs.get('univentionUDMOptionTranslationShortDescription;entry-%s' % lang, attrs['univentionUDMOptionShortDescription'])[0]
		longdesc = attrs.get('univentionUDMOptionTranslationLongDescription;entry-%s' % lang, attrs.get('univentionUDMOptionLongDescription', ['']))[0]
		default = attrs.get('univentionUDMOptionDefault', ['0'])[0] == '1'
		editable = attrs.get('univentionUDMOptionEditable', ['0'])[0] == '1'
		classes = attrs.get('univentionUDMOptionObjectClass', [])

		module.options[oname] = univention.admin.option(
				short_description=shortdesc,
				long_description=longdesc,
				default=default,
				editable=editable,
				objectClasses=classes)
开发者ID:B-Rich,项目名称:smart,代码行数:26,代码来源:modules.py


示例12: cups_printer_enable

	def cups_printer_enable( self, object ):
		cmd = '/usr/bin/univention-cups-enable %s' % ' '.join( object.options[ 'printers' ] )
		ud.debug( ud.ADMIN, ud.INFO, 'CUPS.enable: command: %s' % cmd )
		proc = notifier.popen.Shell( cmd, stdout = False )
		cb = notifier.Callback( self._cups_printer_enable_return, object )
		proc.signal_connect( 'finished', cb )
		proc.start()
开发者ID:B-Rich,项目名称:smart,代码行数:7,代码来源:_quota.py


示例13: cups_printer_disable

 def cups_printer_disable(self, object):
     cmd = "/usr/bin/univention-cups-disable %s" % " ".join(object.options["printers"])
     ud.debug(ud.ADMIN, ud.INFO, "CUPS.enable: command: %s" % cmd)
     proc = notifier.popen.Shell(cmd, stdout=False)
     cb = notifier.Callback(self._cups_printer_disable_return, object)
     proc.signal_connect("finished", cb)
     proc.start()
开发者ID:m-narayan,项目名称:smart,代码行数:7,代码来源:_printer.py


示例14: _pykota_get_quota_users

def _pykota_get_quota_users( printernamelist, callback ):
	cmd = 'LC_ALL="C" LANG="C" /usr/bin/repykota -P%s' % ','.join(printernamelist)

	ud.debug( ud.ADMIN, ud.INFO, 'CUPS.quota command: %s' % cmd )
	proc = notifier.popen.Shell( cmd, stdout = True )
	cb = notifier.Callback( _pykota_get_quota_users_return, callback )
	proc.signal_connect( 'finished', cb )
	proc.start()
开发者ID:B-Rich,项目名称:smart,代码行数:8,代码来源:pykota.py


示例15: _kill_children

def _kill_children(pids, timeout=5):
	"""Kill children."""
	for pid in pids:
		try:
			os.kill(pid, signal.SIGTERM)
		except OSError, ex:
			if ex.errno != errno.ESRCH:
				ud.debug(ud.LISTENER, ud.WARN, 'DNS: Unexpected error: %s' % (ex,))
开发者ID:B-Rich,项目名称:smart,代码行数:8,代码来源:bind.py


示例16: write_rc

def write_rc(no, flist, wfile):
    listener.setuid(0)
    try:
        f = open(wfile,"w")
        f.writelines(flist)
        f.close()
    except Exception, e:
        ud.debug(ud.LISTENER, ud.ERROR, '%d Failed to write file "%s": %s' % (no, wfile, str(e)))
开发者ID:bytemine,项目名称:univention-openvpn,代码行数:8,代码来源:__init__.py


示例17: cups_quota_user_reset

 def cups_quota_user_reset(self, object):
     ud.debug(ud.ADMIN, ud.INFO, "cups_quota_user_reset: %s" % str(object.options))
     pykota._pykota_set_quota(
         notifier.Callback(self._cups_quota_user_reset_return, object),
         printers=[object.options["printer"]],
         userlist=object.options["user"],
         reset=True,
     )
开发者ID:m-narayan,项目名称:smart,代码行数:8,代码来源:_printer.py


示例18: identifyNIC

	def identifyNIC( self, domain_info, options ):
		typ, src, mac = self.optionsNIC( options )

		for iface in domain_info.interfaces:
			if self.sameNIC( iface, typ, src, mac ):
				ud.debug( ud.ADMIN, ud.INFO, 'NIC identify: found %s: %s, %s, %s' % ( str( iface ), typ, src, mac ) )
				return iface

		ud.debug( ud.ADMIN, ud.INFO, 'NIC identify: NOT found' )
开发者ID:B-Rich,项目名称:smart,代码行数:9,代码来源:nic.py


示例19: uvmm_nic_edit

	def uvmm_nic_edit( self, object ):
		ud.debug( ud.ADMIN, ud.INFO, 'Network interface edit' )
		tv = TreeView(self.uvmm, object)
		try:
			res = tv.get_tree_response(TreeView.LEVEL_DOMAIN)
			node_uri = tv.node_uri
			domain_info = tv.domain_info
		except (uvmmd.UvmmError, KeyError), e:
			return self.uvmm_node_overview( object )
开发者ID:B-Rich,项目名称:smart,代码行数:9,代码来源:nic.py


示例20: load_rc

def load_rc(no, ofile):
    l = None
    listener.setuid(0)
    try:
        f = open(ofile,"r")
        l = f.readlines()
        f.close()
    except Exception, e:
        ud.debug(ud.LISTENER, ud.ERROR, '%d Failed to read file "%s": %s' % (no, ofile, str(e)) )
开发者ID:bytemine,项目名称:univention-openvpn,代码行数:9,代码来源:__init__.py



注:本文中的univention.debug.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.MODULE类代码示例发布时间:2022-05-27
下一篇:
Python unittestzero.Assert类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap