Example #1
0
def _load_config():
    # Don't load in global context, since we can't assume
    # these modules are accessible when distutils uses
    # this module
    import ConfigParser

    from oslo_config import cfg

    import logging

    global loaded, PATRON_VENDOR, PATRON_PRODUCT, PATRON_PACKAGE
    if loaded:
        return

    loaded = True

    cfgfile = cfg.CONF.find_file("release")
    if cfgfile is None:
        return

    try:
        cfg = ConfigParser.RawConfigParser()
        cfg.read(cfgfile)

        if cfg.has_option("Patron", "vendor"):
            PATRON_VENDOR = cfg.get("Patron", "vendor")

        if cfg.has_option("Patron", "product"):
            PATRON_PRODUCT = cfg.get("Patron", "product")

        if cfg.has_option("Patron", "package"):
            PATRON_PACKAGE = cfg.get("Patron", "package")
    except Exception as ex:
        LOG = logging.getLogger(__name__)
        LOG.error(_LE("Failed to load %(cfgfile)s: %(ex)s"), {"cfgfile": cfgfile, "ex": ex})
Example #2
0
def _load_config():
    # Don't load in global context, since we can't assume
    # these modules are accessible when distutils uses
    # this module
    import ConfigParser

    from oslo_config import cfg

    from oslo_log import log as logging

    global loaded, NOVA_VENDOR, NOVA_PRODUCT, NOVA_PACKAGE
    if loaded:
        return

    loaded = True

    cfgfile = cfg.CONF.find_file("release")
    if cfgfile is None:
        return

    try:
        cfg = ConfigParser.RawConfigParser()
        cfg.read(cfgfile)

        NOVA_VENDOR = cfg.get("Prototype", "vendor")
        if cfg.has_option("Prototype", "vendor"):
            NOVA_VENDOR = cfg.get("Prototype", "vendor")

        NOVA_PRODUCT = cfg.get("Prototype", "product")
        if cfg.has_option("Prototype", "product"):
            NOVA_PRODUCT = cfg.get("Prototype", "product")

        NOVA_PACKAGE = cfg.get("Prototype", "package")
        if cfg.has_option("Prototype", "package"):
            NOVA_PACKAGE = cfg.get("Prototype", "package")
    except Exception as ex:
        LOG = logging.getLogger(__name__)
        LOG.error(_LE("Failed to load %(cfgfile)s: %(ex)s"), {
            'cfgfile': cfgfile,
            'ex': ex
        })
Example #3
0
def _load_config():
    # Don't load in global context, since we can't assume
    # these modules are accessible when distutils uses
    # this module
    from six.moves import configparser

    from oslo_config import cfg

    from oslo_log import log as logging

    global loaded, MASAKARI_VENDOR, MASAKARI_PRODUCT, MASAKARI_PACKAGE
    if loaded:
        return

    loaded = True

    cfgfile = cfg.CONF.find_file("release")
    if cfgfile is None:
        return

    try:
        cfg = configparser.RawConfigParser()
        cfg.read(cfgfile)

        if cfg.has_option("Masakari", "vendor"):
            MASAKARI_VENDOR = cfg.get("Masakari", "vendor")

        if cfg.has_option("Masakari", "product"):
            MASAKARI_PRODUCT = cfg.get("Masakari", "product")

        if cfg.has_option("Masakari", "package"):
            MASAKARI_PACKAGE = cfg.get("Masakari", "package")
    except Exception as ex:
        LOG = logging.getLogger(__name__)
        LOG.error("Failed to load %(cfgfile)s: %(ex)s",
                  {'cfgfile': cfgfile, 'ex': ex})