當前位置: 首頁>>代碼示例>>Python>>正文


Python syslogger.Syslogger類代碼示例

本文整理匯總了Python中mcvirt.syslogger.Syslogger的典型用法代碼示例。如果您正苦於以下問題:Python Syslogger類的具體用法?Python Syslogger怎麽用?Python Syslogger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Syslogger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的mcvirt.syslogger.Syslogger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。