Exemplo n.º 1
0
    import xmlrpclib
except ImportError:
    # NOTE(jaypipes): xmlrpclib was renamed to xmlrpc.client in Python3
    #                 however the function and object call signatures
    #                 remained the same. This whole try/except block should
    #                 be removed and replaced with a call to six.moves once
    #                 six 1.4.2 is released. See http://bit.ly/1bqrVzu
    import xmlrpc.client as xmlrpclib

import six

from glance.openstack.common import gettextutils
from glance.openstack.common import importutils
from glance.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [
    inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction,
    inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback,
    inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine,
    inspect.isabstract
]

_simple_types = (six.string_types + six.integer_types +
                 (type(None), bool, float))


def to_primitive(value,
                 convert_instances=False,
                 convert_datetime=True,
Exemplo n.º 2
0
    import xmlrpclib
except ImportError:
    # NOTE(jaypipes): xmlrpclib was renamed to xmlrpc.client in Python3
    #                 however the function and object call signatures
    #                 remained the same. This whole try/except block should
    #                 be removed and replaced with a call to six.moves once
    #                 six 1.4.2 is released. See http://bit.ly/1bqrVzu
    import xmlrpc.client as xmlrpclib

import six

from glance.openstack.common import gettextutils
from glance.openstack.common import importutils
from glance.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
                     inspect.isfunction, inspect.isgeneratorfunction,
                     inspect.isgenerator, inspect.istraceback, inspect.isframe,
                     inspect.iscode, inspect.isbuiltin, inspect.isroutine,
                     inspect.isabstract]

_simple_types = (six.string_types + six.integer_types
                 + (type(None), bool, float))


def to_primitive(value, convert_instances=False, convert_datetime=True,
                 level=0, max_depth=3):
    """Convert a complex object into primitives.
Exemplo n.º 3
0
import signal
import sys
import time

import eventlet
import logging as std_logging
from oslo.config import cfg

from glance.openstack.common import eventlet_backdoor
from glance.openstack.common.gettextutils import _
from glance.openstack.common import importutils
from glance.openstack.common import log as logging
from glance.openstack.common import threadgroup


rpc = importutils.try_import('glance.openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)


class Launcher(object):
    """Launch one or more services and wait for them to complete."""

    def __init__(self):
        """Initialize the service launcher.

        :returns: None

        """
        self._services = threadgroup.ThreadGroup()
        eventlet_backdoor.initialize_if_enabled()
Exemplo n.º 4
0
import random
import signal
import sys
import time

import eventlet
import logging as std_logging
from oslo.config import cfg

from glance.openstack.common import eventlet_backdoor
from glance.openstack.common.gettextutils import _
from glance.openstack.common import importutils
from glance.openstack.common import log as logging
from glance.openstack.common import threadgroup

rpc = importutils.try_import('glance.openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)


class Launcher(object):
    """Launch one or more services and wait for them to complete."""
    def __init__(self):
        """Initialize the service launcher.

        :returns: None

        """
        self._services = threadgroup.ThreadGroup()
        eventlet_backdoor.initialize_if_enabled()