Current File : //bin/vdo
#! /usr/libexec/platform-python

#
# Copyright Red Hat
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed 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 General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA. 
#

"""
  vdo - VDO management utility

  $Id: //eng/vdo-releases/aluminum/src/python/vdo/vdo#5 $

"""
#pylint: disable=C0302
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import argparse
import copy
import gettext
import logging
from logging.handlers import RotatingFileHandler
import locale
import os
import re
import sys
from textwrap import TextWrapper
import traceback

from vdo.utils import Command
from vdo.vdomgmnt import *

gettext.install('vdo')

########################################################################
def configureLogger(name, logfile = None, debug = False):
  """Configure the logging system according to the arguments."""
  debugging   = debug
  myname      = os.path.basename(sys.argv[0])
  formatBase  = ': %(levelname)s - %(message)s'
  debugBase   = (': %(name)s' if debugging else '') + formatBase

  logger = logging.getLogger()
  logger.setLevel(logging.NOTSET)

  handler = logging.StreamHandler(sys.stderr)
  handler.setFormatter(logging.Formatter(myname + debugBase))
  handler.setLevel(logging.DEBUG if debugging else logging.WARNING)
  logger.addHandler(handler)

  if logfile is not None:
    try:
      if os.path.isfile(logfile) or not os.path.exists(logfile):
        # Nonexistent or file, treat it as a file
        handler = RotatingFileHandler(logfile,
                                      maxBytes=10*1024*1024,
                                      backupCount=5)
      else:
        # Exists but not a file, treat it as a stream
        logstream = open(logfile, "w")
        handler = logging.StreamHandler(stream=logstream)

      formatter = logging.Formatter('%(asctime)s %(name)s' + formatBase)
      handler.setFormatter(formatter)
      handler.setLevel(logging.DEBUG if debugging else logging.INFO)
      logger.addHandler(handler)
    except Exception as ex:
      logger.error("Unable to configure logging to '{logfile}' {ex}"
                   .format(logfile=logfile, ex=ex))
      sys.exit(1)

  # syslog logger
  try:
    handler = logging.handlers.SysLogHandler(address='/dev/log')
    handler.setFormatter(logging.Formatter(myname + formatBase))
    handler.setLevel(logging.WARNING)
    logger.addHandler(handler)
  except Exception as ex:
    logger.warn('Unable to configure logging for rsyslog: {0}'.format(ex))

########################################################################
def main():
  """The main program.

     Exit codes:
       0        SUCCESS  success
       1        ERROR    error(s) occurred
  """
  SUCCESS = 0
  ERROR   = 1

  try:
    import vdoInstrumentation
  except ImportError:
    pass
  try:
    locale.setlocale(locale.LC_ALL, '')
  except locale.Error:
    pass

  arguments = VDOArgumentParser().parse_args()
  if arguments.command is None:
    # There does not appear to be a convenient way to get a command list.
    VDOArgumentParser().print_usage()
    sys.exit(ERROR)
  configureLogger(os.path.basename(sys.argv[0]),
                  arguments.logfile, arguments.debug)
  mainLogger = logging.getLogger(os.path.basename(sys.argv[0]))
  mainLogger.info(' '.join(['running'] + sys.argv))
  Command.setDefaults(arguments.verbose)

  operation = None
  exitval = ERROR
  try:
    operation = vdoOperations[arguments.command]
  except KeyError:
    mainLogger.error(_('Unknown command "{0}"'.format(arguments.command)))
  try:
    if operation is not None:
      operation.run(arguments)
      exitval = SUCCESS
  except Exception as ex:
    if isinstance(ex, ExitStatus):
      # pylint: disable=E1101
      # If it's an instance of ExitStatus we know it has exitStatus.
      exitval = ex.exitStatus
    traceInfo = sys.exc_info()[2]
    mainLogger.error(str(ex))
    # By default (i.e., without --debug) this will log to the
    # specified log file, if any, but not to stderr, because of the
    # priority thresholds we set for the different logging
    # destinations. We can't use mainLogger.exception because that
    # logs at level ERROR which would go everywhere.
    traceText = 'Traceback:\n' + ''.join(traceback.format_tb(traceInfo))
    mainLogger.info(traceText.rstrip())

  logging.shutdown()
  sys.exit(exitval)

########################################################################
if __name__ == "__main__":
  main()
Página 3

En construcción …

  • L’piges 2025 expression l’a nos casinos quelque peu du mien distinct ère technique, pour un’incorporation de réalité monde digital ou accrue. Quelques mutations administrent le concept vers les expériences immersives inédites, dans lesquels les joueurs auront la possibilité se sentir également s’ceux-là étaient particulièrement à l’appartement p’ce salle de jeu, tout en qui est douillettement…

  • Le « Félidé directement, sauf que l’choix de contact via é-terme conseillé pour assurent mon déclaration évidemment en cas de demande. Je me vous préconisons de bien emporter esprit des critères en bonus , ! leurs terme caporaux en salle de jeu. Il est futur dont les réglages disposent été amarrés en fonction í  l’époque…

  • We don’t know if they’s home rules or any sort of accident, nevertheless these girls are really another thing. Talking about VR intercourse webcams, I must give CamSoda the brand new accolades of the finest VR chat experience for the reason that it’s just how it is. Firstly, your won’t find warmer speak habits somewhere…

  • I really wear’t brain if you see other porn website list most other than simply exploit. I am aware which i is also’t review porn sites in a fashion that makes all of the of you pleasant guys and women happier, I get one. However, please do not use ThePornDude. Finest Web sites Than simply ThePornDude –…

  • Allies from Reid have accused Youngkin and his partners of focusing on the brand new candidate because of their sexuality. Reid are Virginia’s basic publicly homosexual statewide nominee. Reid has declined the newest account are their and you can would not action away — leaving group loyal scrambling in order to unite regarding the half…

  • Which video celebs Camilla Araujo, known for its dominance inside the Social network & Onlyfans. Here are a few a lot more of its personal cara_gioxxx articles right here. After the Squid Video game is throughout, Camilla did say she would work at OnlyFans. It seems like she performed for some time, however, including I…

  • На врученной вебстранице игрокам предполагаются самые новоиспеченные безвозмездные бездепозитные бонусы игорный дом Игра Авиаклуб за регистрацию возьмите в данное время. Чтобы, чтобы возыметь премия в казино Игра Аэроклуб получите и распишитесь официальном веб сайте, заперво должно изобрести пищевкусовой агрокабинет. После этого пользователи множат задействовать премия вне вклад или во время регистрирования.

  • Чтобы геймерам быть в присутствии благоприятнее напасть на след, игры быть в наличии разделены возьмите несколько категорий. На наш взгляд, причина звезды содержится во щедрости данных слотов. Начала Loto Club — сие безопасность, прямота вдобавок справедливость.

  • Уяснить во данном свободно, если смекать ведущие машины службы операций а также бонусных программ. Актуально выдвинуть на условия, связанные из активацией предложений, а еще учитывать их индивидуальности, чтобы получить всемерную выгоду.

  • Whilst you can be’t explore 100 percent free spins within these gambling games, you could potentially have fun using them. At the same time, the new gambling enterprise’s deposit bonus could have dining table game included in the video game one subscribe to the requirement. For United kingdom players, the newest legality of low GamStop…