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

Python syslogger.Syslogger类代码示例

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

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



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

示例1: _get_auth_obj

    def _get_auth_obj(self, password=None):
        """Setup annotations for authentication"""
        auth_dict = {
            Annotations.USERNAME: self.__username
        }
        if password:
            auth_dict[Annotations.PASSWORD] = password
        elif self.__session_id:
            auth_dict[Annotations.SESSION_ID] = self.__session_id
        if self.__proxy_username:
            auth_dict[Annotations.PROXY_USER] = self.__proxy_username

        if self.__cluster_master is not None:
            Syslogger.logger().warning('Setting cluster master to %s' % self.__cluster_master)
            auth_dict[Annotations.CLUSTER_MASTER] = self.__cluster_master

        if 'has_lock' in dir(Pyro4.current_context):
            auth_dict[Annotations.HAS_LOCK] = Pyro4.current_context.has_lock

        auth_dict[Annotations.IGNORE_CLUSTER] = self.__ignore_cluster
        if 'ignore_cluster' in dir(Pyro4.current_context):
            auth_dict[Annotations.IGNORE_CLUSTER] |= Pyro4.current_context.ignore_cluster
        auth_dict[Annotations.IGNORE_DRBD] = self.__ignore_drbd
        if 'ignore_drbd' in dir(Pyro4.current_context):
            auth_dict[Annotations.IGNORE_DRBD] |= Pyro4.current_context.ignore_drbd
        return auth_dict
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:26,代码来源:rpc.py


示例2: validateHandshake

    def validateHandshake(self, conn, data):  # Override name of upstream method # noqa
        """Perform authentication on new connections"""
        self.handshake__set_defaults()

        # Attempt to perform authentication sequence
        try:
            # Authenticate user and obtain username and session id
            username, session_id = self.handshake__authenticate_user(data)

            # Determine if user can provide alternative users
            session_instance = self.registered_factories['mcvirt_session']
            user_object = session_instance.get_current_user_object()

            # Set proxy user
            self.handshake__set_proxy_user(data, user_object)

            # Set cluster master
            self.handshake__set_cluster_master(data, user_object)

            # Set has lock
            self.handshake__set_has_lock(data, user_object)

            # Set ignore cluster and DRBD
            self.handshake__set_ignore_cluster(data, user_object)
            self.handshake__set_ignore_drbd(data, user_object)

            # Perform node version check
            self.handshake__check_cluster_version()

            # Return the session id
            return session_id

        except Pyro4.errors.SecurityError, e:
            Syslogger.logger().exception('SecurityError during authentication: %s' % str(e))
            raise
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:35,代码来源:rpc_daemon.py


示例3: start

 def start(self):
     self.start_time = datetime.now()
     self.status = LogState.RUNNING
     Syslogger.logger().debug('                     Start command: %s' % ', '.join([
         str(self.start_time), self.user or '', self.object_type or '', self.object_name or '',
         self.method_name or ''
     ]))
开发者ID:Adimote,项目名称:MCVirt,代码行数:7,代码来源:logger.py


示例4: finish

    def finish(self):
        """Mark the transaction as having been completed"""
        self.comlpete = True
        # Only remove transaction if it is the last
        # transaction in the stack
        if self.id == Transaction.transactions[-1].id:
            Syslogger.logger().debug('End of transaction stack')

            # Tear down all transactions
            for transaction in Transaction.transactions:
                # Delete each of the function objects
                for func in transaction.functions:
                    transaction.functions.remove(func)
                    func.unregister(force=True)
                    del func

            # Reset list of transactions
            Transaction.transactions = []
        else:
            # Otherwise, remove this transaction
            Syslogger.logger().debug('End of transaction')

            # Delete each of the function objects
            for func in self.functions:
                self.functions.remove(func)
                func.unregister(force=True)
                del func

            # @TODO HOW CAN THIS NO LONGER BE IN THE LIST?
            if self in Transaction.transactions:
                Transaction.transactions.remove(self)
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:31,代码来源:expose_method.py


示例5: finish_success

 def finish_success(self):
     self.finish_time = datetime.now()
     self.status = LogState.SUCCESS
     Syslogger.logger().debug('        Command complete (success): %s' % ', '.join([
         str(self.finish_time), self.user or '', self.object_type or '', self.object_name or '',
         self.method_name or ''
     ]))
开发者ID:Adimote,项目名称:MCVirt,代码行数:7,代码来源:logger.py


示例6: undo

    def undo(self):
        """Execute the undo method for the function"""
        # If the local node is in the list of complete
        # commands, then undo it first
        if (get_hostname() in self.nodes and
                self.nodes[get_hostname()]['complete'] and
                hasattr(self.obj, self._undo_function_name)):

            # Set current node
            local_hostname = get_hostname()
            self.current_node = local_hostname

            Syslogger.logger().debug('Undo %s %s %s %s' %
                                     (get_hostname(),
                                      self._undo_function_name,
                                      str(self.nodes[get_hostname()]['args']),
                                      str(self.nodes[get_hostname()]['kwargs'])))
            getattr(self.obj, self._undo_function_name)(
                *self.nodes[get_hostname()]['args'],
                **self.nodes[get_hostname()]['kwargs'])

        # Iterate through nodes and undo
        for node in self.nodes:
            # Skip local node or if the function did not complete on the node
            if node == get_hostname() or not self.nodes[node]['complete']:
                continue

            # Run the remote undo method
            Syslogger.logger().debug('Undo %s %s %s %s' %
                                     (node,
                                      self.function.__name__,
                                      str(self.nodes[node]['args']),
                                      str(self.nodes[node]['kwargs'])))
            self._call_function_remote(node=node, undo=True)
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:34,代码来源:expose_method.py


示例7: set_state

 def set_state(self, new_state):
     """Set state"""
     if self.state != new_state:
         Syslogger.logger().debug(
             'State for (%s) changed from %s to %s' %
             (self.virtual_machine.get_name(),
              self.state, new_state))
         self.state = new_state
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:8,代码来源:watchdog.py


示例8: initialise

    def initialise(self):
        """Detect running VMs on local node and create watchdog daemon"""
        # Check all VMs
        for virtual_machine in self._get_registered_object(
                'virtual_machine_factory').get_all_virtual_machines():

            Syslogger.logger().debug('Registering watchdog for: %s' % virtual_machine.get_name())
            self.start_watchdog(virtual_machine)
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:8,代码来源:watchdog.py


示例9: interval

 def interval(self):
     """Return the timer interval"""
     if self.state is WATCHDOG_STATES.STARTUP:
         boot_wait = self.virtual_machine.get_watchdog_boot_wait()
         Syslogger.logger().debug(
             'In boot period, interval is: %s' % boot_wait)
         return boot_wait
     else:
         return self.virtual_machine.get_watchdog_interval()
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:9,代码来源:watchdog.py


示例10: register

 def register(self, obj_or_class, objectId, *args, **kwargs):  # Override upstream # noqa
     """Override register to register object with NS."""
     Syslogger.logger().debug('Registering object: %s' % objectId)
     uri = RpcNSMixinDaemon.DAEMON.register(obj_or_class, *args, **kwargs)
     ns = Pyro4.naming.locateNS(host=self.hostname, port=9090, broadcast=False)
     ns.register(objectId, uri)
     ns = None
     RpcNSMixinDaemon.DAEMON.registered_factories[objectId] = obj_or_class
     return uri
开发者ID:joesingo,项目名称:MCVirt,代码行数:9,代码来源:rpc_daemon.py


示例11: finish_error

 def finish_error(self, exception):
     self.finish_time = datetime.now()
     self.status = LogState.FAILED
     self.exception_message = str(exception)
     self.exception_mcvirt = True
     Syslogger.logger().error(' Command failed (MCVirt Exception): %s' % ', '.join([
         str(self.finish_time), self.user or '', self.object_type or '', self.object_name or '',
         self.method_name or '', self.exception_message or ''
     ]))
开发者ID:Adimote,项目名称:MCVirt,代码行数:9,代码来源:logger.py


示例12: start

 def start(self, *args, **kwargs):
     """Start the Pyro daemon"""
     Pyro4.current_context.STARTUP_PERIOD = False
     Syslogger.logger().debug('Authentication enabled')
     Syslogger.logger().debug('Obtaining lock')
     with DaemonLock.LOCK:
         Syslogger.logger().debug('Obtained lock')
         Syslogger.logger().debug('Starting daemon request loop')
         RpcNSMixinDaemon.DAEMON.requestLoop(*args, **kwargs)
     Syslogger.logger().debug('Daemon request loop finished')
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:10,代码来源:rpc_daemon.py


示例13: obtain_connection

 def obtain_connection(self):
     """Attempt to obtain a connection to the name server."""
     while 1:
         try:
             Pyro4.naming.locateNS(host=self.hostname, port=9090, broadcast=False)
             return
         except Exception as e:
             Syslogger.logger().warn('Connecting to name server: %s' % str(e))
             # Wait for 1 second for name server to come up
             time.sleep(1)
开发者ID:joesingo,项目名称:MCVirt,代码行数:10,代码来源:rpc_daemon.py


示例14: run

    def run(self):
        """Obtain CPU and memory statistics"""
        Pyro4.current_context.INTERNAL_REQUEST = True
        Syslogger.logger().debug('Starting host stats gathering')
        self._cpu_usage = OSStats.get_cpu_usage()
        self._memory_usage = OSStats.get_ram_usage()
        self.insert_into_stat_db()
        Syslogger.logger().debug('Completed host stats gathering')

        Pyro4.current_context.INTERNAL_REQUEST = False
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:10,代码来源:host_statistics.py


示例15: dh_params_file

    def dh_params_file(self):
        """Return the path to the DH parameters file, and create it if it does not exist"""
        if not self.is_local:
            raise CACertificateNotFoundException('DH params file not available for remote node')

        path = self._get_certificate_path('dh_params')
        if not self._ensure_exists(path, assert_raise=False):
            # Generate new DH parameters
            Syslogger.logger().info('Generating DH parameters file')
            System.runCommand([self.OPENSSL, 'dhparam', '-out', path, '2048'])
            Syslogger.logger().info('DH parameters file generated')
        return path
开发者ID:joesingo,项目名称:MCVirt,代码行数:12,代码来源:certificate_generator.py


示例16: start

 def start(self):
     self.start_time = datetime.now()
     self.status = LogState.RUNNING
     Syslogger.logger().debug('Start command: %s' % ', '.join([
         str(self.start_time), self.user or '', self.object_type or '', self.object_name or '',
         self.method_name or ''
     ]))
     for remote_log in self.remote_logs:
         try:
             remote_log.start()
         except:
             pass
开发者ID:joesingo,项目名称:MCVirt,代码行数:12,代码来源:logger.py


示例17: finish_error_unknown

 def finish_error_unknown(self, exception):
     self.finish_time = datetime.now()
     self.status = LogState.FAILED
     self.exception_message = str(exception)
     self.exception_mcvirt = False
     Syslogger.logger().error('Command failed (Unknown Exception): %s' % ', '.join([
         str(self.finish_time), self.user or '', self.object_type or '', self.object_name or '',
         self.method_name or '', self.exception_message or ''
     ]))
     for remote_log in self.remote_logs:
         try:
             remote_log.finish_error_unknown(str(exception))
         except:
             pass
     self.unregister()
开发者ID:joesingo,项目名称:MCVirt,代码行数:15,代码来源:logger.py


示例18: repeat_run

    def repeat_run(self):
        """Re-start timer once run has complete"""
        # Restart timer, if set to repeat before run
        if not self.repeat_after_run and self.repeat:
            self.timer = Timer(float(self.interval), self.repeat_run)
            self.timer.start()

        return_output = None
        try:
            # Run command
            return_output = self.run(*self.run_args, **self.run_kwargs)
        except Exception, exc:
            Syslogger.logger().error(
                'Error ocurred during thread: %s\n%s' %
                (self.__class__.__name__, str(exc)))
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:15,代码来源:repeat_timer.py


示例19: authenticate_session

    def authenticate_session(self, username, session):
        """Authenticate user session."""
        Syslogger.logger().debug("Authenticating session for user %s: %s" % (username, session))

        if (session in Session.USER_SESSIONS and
                Session.USER_SESSIONS[session].username == username):

            # Check session has not expired
            if Session.USER_SESSIONS[session].is_valid():
                Session.USER_SESSIONS[session].renew()
                user_factory = self._get_registered_object('user_factory')
                return user_factory.get_user_by_username(username)
            else:
                del Session.USER_SESSIONS[session]

        raise AuthenticationError('Invalid session ID')
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:16,代码来源:session.py


示例20: __init__

    def __init__(self):
        """Setup member variables and register transaction"""
        # Determine transaction ID.
        self._id = len(Transaction.transactions)

        # Initialise LIFO stack of functions
        self.functions = []

        # Initialise with an incomplete state
        self.complete = False

        # Only register transacstion is not in an undo-state
        if not Transaction.undo_state:
            # Add the transaction to the static list of transactions
            Transaction.transactions.insert(0, self)
            Syslogger.logger().debug('Starting new transaction')
开发者ID:ITDevLtd,项目名称:MCVirt,代码行数:16,代码来源:expose_method.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python system.System类代码示例发布时间:2022-05-27
下一篇:
Python logger.LOG类代码示例发布时间: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