Example #1
0
import requests
import six
from six.moves.urllib import parse

from oslo.serialization import jsonutils

from heatclient import exc
from heatclient.openstack.common import importutils
from heatclient.openstack.common import strutils

LOG = logging.getLogger(__name__)
USER_AGENT = 'python-heatclient'
CHUNKSIZE = 1024 * 64  # 64kB
SENSITIVE_HEADERS = ('X-Auth-Token',)
osprofiler_web = importutils.try_import("osprofiler.web")


def get_system_ca_file():
    """Return path to system default CA file."""
    # Standard CA file locations for Debian/Ubuntu, RedHat/Fedora,
    # Suse, FreeBSD/OpenBSD, MacOSX, and the bundled ca
    ca_path = ['/etc/ssl/certs/ca-certificates.crt',
               '/etc/pki/tls/certs/ca-bundle.crt',
               '/etc/ssl/ca-bundle.pem',
               '/etc/ssl/cert.pem',
               '/System/Library/OpenSSL/certs/cacert.pem',
               requests.certs.where()]
    for ca in ca_path:
        LOG.debug("Looking for ca file %s", ca)
        if os.path.exists(ca):
Example #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 heatclient.openstack.common import gettextutils
from heatclient.openstack.common import importutils
from heatclient.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.
Example #3
0
from keystoneclient.auth.identity import v2 as v2_auth
from keystoneclient.auth.identity import v3 as v3_auth
from keystoneclient import discover
from keystoneclient.openstack.common.apiclient import exceptions as ks_exc
from keystoneclient import session as kssession

import heatclient
from heatclient import client as heat_client
from heatclient.common import utils
from heatclient import exc
from heatclient.openstack.common.gettextutils import _
from heatclient.openstack.common import importutils
from heatclient.openstack.common import strutils

logger = logging.getLogger(__name__)
osprofiler_profiler = importutils.try_import("osprofiler.profiler")


class HeatShell(object):

    def _append_global_identity_args(self, parser):
        # FIXME(gyee): these are global identity (Keystone) arguments which
        # should be consistent and shared by all service clients. Therefore,
        # they should be provided by python-keystoneclient. We will need to
        # refactor this code once this functionality is avaible in
        # python-keystoneclient.
        parser.add_argument('-k', '--insecure',
                            default=False,
                            action='store_true',
                            help='Explicitly allow heatclient to perform '
                            '\"insecure SSL\" (https) requests. The server\'s '
Example #4
0
import socket

import requests
import six
from six.moves.urllib import parse

from heatclient import exc
from heatclient.openstack.common import importutils
from heatclient.openstack.common import jsonutils
from heatclient.openstack.common import strutils

LOG = logging.getLogger(__name__)
USER_AGENT = 'python-heatclient'
CHUNKSIZE = 1024 * 64  # 64kB
SENSITIVE_HEADERS = ('X-Auth-Token', )
osprofiler_web = importutils.try_import("osprofiler.web")


def get_system_ca_file():
    """Return path to system default CA file."""
    # Standard CA file locations for Debian/Ubuntu, RedHat/Fedora,
    # Suse, FreeBSD/OpenBSD, MacOSX, and the bundled ca
    ca_path = [
        '/etc/ssl/certs/ca-certificates.crt',
        '/etc/pki/tls/certs/ca-bundle.crt', '/etc/ssl/ca-bundle.pem',
        '/etc/ssl/cert.pem', '/System/Library/OpenSSL/certs/cacert.pem',
        requests.certs.where()
    ]
    for ca in ca_path:
        LOG.debug("Looking for ca file %s", ca)
        if os.path.exists(ca):
    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 heatclient.openstack.common import gettextutils
from heatclient.openstack.common import importutils
from heatclient.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,