コード例 #1
0
ファイル: shell.py プロジェクト: kbijon/OpenStack-CVRM
import six.moves.urllib.parse as urlparse

import glanceclient
from glanceclient.common import utils
from glanceclient import exc
from glanceclient.openstack.common.gettextutils import _
from glanceclient.openstack.common import importutils
from glanceclient.openstack.common import strutils

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

osprofiler_profiler = importutils.try_import("osprofiler.profiler")


class OpenStackImagesShell(object):

    def _append_global_identity_args(self, parser):
        # FIXME(bobt): 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. See
        #
        # https://bugs.launchpad.net/python-keystoneclient/+bug/1332337
        #
        parser.add_argument('-k', '--insecure',
                            default=False,
コード例 #2
0
    import json
except ImportError:
    import simplejson as json

# Python 2.5 compat fix
if not hasattr(parse, 'parse_qsl'):
    import cgi
    parse.parse_qsl = cgi.parse_qsl

from glanceclient.common import https
from glanceclient import exc
from glanceclient.openstack.common import importutils
from glanceclient.openstack.common import network_utils
from glanceclient.openstack.common import strutils

osprofiler_web = importutils.try_import("osprofiler.web")

LOG = logging.getLogger(__name__)
USER_AGENT = 'python-glanceclient'
CHUNKSIZE = 1024 * 64  # 64kB


class HTTPClient(object):
    def __init__(self, endpoint, **kwargs):
        self.endpoint = endpoint
        self.identity_headers = kwargs.get('identity_headers')
        self.auth_token = kwargs.get('token')
        if self.identity_headers:
            if self.identity_headers.get('X-Auth-Token'):
                self.auth_token = self.identity_headers.get('X-Auth-Token')
                del self.identity_headers['X-Auth-Token']
コード例 #3
0
ファイル: http.py プロジェクト: kbijon/OpenStack-CVRM
    import json
except ImportError:
    import simplejson as json

# Python 2.5 compat fix
if not hasattr(parse, 'parse_qsl'):
    import cgi
    parse.parse_qsl = cgi.parse_qsl

from glanceclient.common import https
from glanceclient.common.utils import safe_header
from glanceclient import exc
from glanceclient.openstack.common import importutils
from glanceclient.openstack.common import strutils

osprofiler_web = importutils.try_import("osprofiler.web")

LOG = logging.getLogger(__name__)
USER_AGENT = 'python-glanceclient'
CHUNKSIZE = 1024 * 64  # 64kB


class HTTPClient(object):

    def __init__(self, endpoint, **kwargs):
        self.endpoint = endpoint
        self.identity_headers = kwargs.get('identity_headers')
        self.auth_token = kwargs.get('token')
        if self.identity_headers:
            if self.identity_headers.get('X-Auth-Token'):
                self.auth_token = self.identity_headers.get('X-Auth-Token')
コード例 #4
0
import six.moves.urllib.parse as urlparse

import glanceclient
from glanceclient.common import utils
from glanceclient import exc
from glanceclient.openstack.common.gettextutils import _
from glanceclient.openstack.common import importutils
from glanceclient.openstack.common import strutils

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

osprofiler_profiler = importutils.try_import("osprofiler.profiler")


class OpenStackImagesShell(object):
    def _append_global_identity_args(self, parser):
        # FIXME(bobt): 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. See
        #
        # https://bugs.launchpad.net/python-keystoneclient/+bug/1332337
        #
        parser.add_argument('-k',
                            '--insecure',
                            default=False,