Ejemplo n.º 1
0
    # Python 2.6
    UnsupportedOperation = None

import eventlet
from eventlet import event
from oslo.config import cfg

from entropy.openstack.common import eventlet_backdoor
from entropy.openstack.common.gettextutils import _LE, _LI, _LW
from entropy.openstack.common import importutils
from entropy.openstack.common import log as logging
from entropy.openstack.common import systemd
from entropy.openstack.common import threadgroup


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


def _sighup_supported():
    return hasattr(signal, 'SIGHUP')


def _is_daemon():
    # The process group for a foreground process will match the
    # process group of the controlling terminal. If those values do
    # not match, or ioctl() fails on the stdout file handle, we assume
    # the process is running in the background as a daemon.
    # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics
    try:
Ejemplo n.º 2
0
except ImportError:
    # Python 2.6
    UnsupportedOperation = None

import eventlet
from eventlet import event
from oslo.config import cfg

from entropy.openstack.common import eventlet_backdoor
from entropy.openstack.common.gettextutils import _LE, _LI, _LW
from entropy.openstack.common import importutils
from entropy.openstack.common import log as logging
from entropy.openstack.common import systemd
from entropy.openstack.common import threadgroup

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


def _sighup_supported():
    return hasattr(signal, 'SIGHUP')


def _is_daemon():
    # The process group for a foreground process will match the
    # process group of the controlling terminal. If those values do
    # not match, or ioctl() fails on the stdout file handle, we assume
    # the process is running in the background as a daemon.
    # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics
    try:
Ejemplo n.º 3
0
        is_simplejson = True
    except ImportError:
        import json
else:
    import json

import six
import six.moves.xmlrpc_client as xmlrpclib

from entropy.openstack.common import gettextutils
from entropy.openstack.common import importutils
from entropy.openstack.common import strutils
from entropy.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,
]
Ejemplo n.º 4
0
        import simplejson as json
        is_simplejson = True
    except ImportError:
        import json
else:
    import json

import six
import six.moves.xmlrpc_client as xmlrpclib

from entropy.openstack.common import gettextutils
from entropy.openstack.common import importutils
from entropy.openstack.common import strutils
from entropy.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,