def __init__(self, parent, base, conf):
        self._parent = parent
        self._base = base
        self._conf = conf

        self.logger = getLog()
        self.verbose_logger = getLog(prefix="verbose.")
Esempio n. 2
0
def __activate_warp(warp_speed=100):
    moduleLog.debug(         "moduleLog         debug")
    moduleLog.info(          "moduleLog         info")
    moduleLog.warning(       "moduleLog         warning")
    getLog("trace.warp").info("trace.warp info msg")
    moduleLog.warning("Activating Warp Drive! Speed=%s" % warp_speed) 
    moduleLogVerbose.debug(  "moduleLog verbose debug")
    moduleLogVerbose.info(   "moduleLog verbose info")
    moduleLogVerbose.warning("moduleLog verbose warning")
Esempio n. 3
0
    def _freeLibStringFN(result, func, args):
        getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
        pystr = ctypes.cast(result, ctypes.c_char_p).value
        if pystr is None:
            pystr = ""
            #_doExc(exception_fn, result, func, args, _("null string returned") )

        free_fn(result)
        return pystr
Esempio n. 4
0
    def _freeLibStringFN(result, func, args):
        getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
        pystr = ctypes.cast(result, ctypes.c_char_p).value
        if pystr is None:
            pystr = ""
            #_doExc(exception_fn, result, func, args, _("null string returned") )

        free_fn(result)
        return pystr
Esempio n. 5
0
def customFree(result, func, args):
    getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
    size = args[1]._obj.value
    pystr = ""
    if bool(result) and size >= 0:
        pystr = result[0:size]
        DLL.token_string_free(result)
    else:
        raise TokenManipulationFailure(_obj_strerror(a[0]))
    return pystr
    def __init__(self, base, optparser=None, types=None, disabled=None):
        '''Initialise the instance.
        '''
        self.base = base
        self.optparser = optparser
        self.cmdline = (None, None)

        self.verbose_logger = getLog(prefix="verbose.")

        self.disabledPlugins = disabled
        if types is None:
            types = ALL_TYPES
        if not isinstance(types, (list, tuple)):
            types = (types, )

        # TODO: load plugins here
        self._plugins = {}
        for i in self.base.listPluginsFromIni():
            conf = self.base.getPluginConfFromIni(i)
            moduleLogVerbose.info("Checking Plugin (%s)" % i)
            if conf.enabled:
                self._loadModule(i, conf, types)

        # Call close handlers when yum exit's
        #atexit.register(self.run, 'close')

        # Let plugins register custom config file options
        self.run('config')
Esempio n. 7
0
    def __init__(self):
        self.logger = getLog()
        self.verbose_logger = getLog(prefix="verbose.")

        self.cmdargs = []
        self.cb = None

        self._conf = None
        self._repo = None
        self._systemInventory = None
        self._vendorId = None
        self._systemId = None

        self.verbosity = 0
        self.trace = 0
        self.loggingConfig = os.path.join(PKGCONFDIR, "firmware.conf")

        # Start with plugins disabled
        self.disablePlugins()
Esempio n. 8
0
"""

import csv
import sys
import logging
import logging.config
import ConfigParser
import traceback
from optparse import OptionParser, OptionGroup

# our stuff
from trace_decorator import decorate, traceLog, getLog

__VERSION__="1.0"

moduleLog = getLog()
moduleLogVerbose = getLog(prefix="verbose.")

class CLIError(Exception): pass

def get_basic_parser(usage=None, version=None):
    kwargs = {}
    if usage is not None:
        kwargs["usage"] = usage
    if version is not None:
        kwargs["version"] = version
    parser = OptionParser(**kwargs)
    parser.add_option("-c", "--config-file", action="store", dest="configfile", help="specify configuration file", default=None)

    group = OptionGroup(parser, "Verbosity")
    group.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="Silence all non-critical program output", default=1)
Esempio n. 9
0
from libsmbios_c import system_info as sysinfo, smbios, token, localedir, GETTEXT_PACKAGE
from trace_decorator import decorate, traceLog, getLog

from _vars import *
import gettext
_ = gettext.translation(GETTEXT_PACKAGE, localedir, fallback=True).ugettext

# use python-decoratortools if it is installed, otherwise use our own local
# copy. Imported this locally because it doesnt appear to be available on SUSE
# and the fedora RPM doesnt appear to compile cleanly on SUSE
try:
    from peak.util.decorators import decorate_class
except ImportError:
    from libsmbios_c._peak_util_decorators import decorate_class

moduleLog = getLog()
verboseLog = getLog(prefix="verbose.")

class InappropriateHDRFile(Exception): pass

RBU_SMBIOS_STRUCT = 0xDE
TOKEN_RBU_CANCEL = 0x005d
TOKEN_RBU_STAGE  = 0x005c

completion_messages = {
    0x0000: _("The update was completed successfully."),
    0x0001: _("The image failed one or more consistency checks."),
    0x0002: _("The BIOS could not access the flash-memory device."),
    0x0003: _("The flash-memory device was not ready when an erase was attempted."),
    0x0004: _("Flash programming is currently disabled on the system, or the voltage is low."),
    0x0005: _("A battery must be installed for the operation to complete."),
Esempio n. 10
0
 def _errorOnNegativeFN(result, func, args):
     getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
     if result is None or result < 0:
         _doExc(exception_fn, result, func, args,
                _("function returned negative error code"))
     return result
Esempio n. 11
0
 def _errorOnZeroFN(result, func, args):
     getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
     if result is None or result == 0:
         _doExc(exception_fn, result, func, args,
                _("function returned error value of zero"))
     return result
Esempio n. 12
0
 def _errorOnNullPtrFN(result, func, args):
     getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
     if not bool(result):  # check for null pointer
         _doExc(exception_fn, result, func, args,
                _("null pointer returned"))
     return result
Esempio n. 13
0
 def _errorOnNegativeFN(result, func, args):
     getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
     if result is None or result < 0:
         _doExc(exception_fn, result, func, args, _("function returned negative error code") )
     return result
Esempio n. 14
0
 def _errorOnZeroFN(result, func, args):
     getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
     if result is None or result == 0:
         _doExc(exception_fn, result, func, args, _("function returned error value of zero") )
     return result
Esempio n. 15
0
 def _errorOnNullPtrFN(result, func, args):
     getLog(prefix="trace.").info("RAN CTYPES FUNCTION: %s" % func.__name__)
     if not bool(result): # check for null pointer
         _doExc(exception_fn, result, func, args, _("null pointer returned") )
     return result