Bump hacking version
Current hacking version is incompatible with the one in the global requirements. Match the hacking module version and made the necessary changes to pass the tests. Change-Id: Ie6b13a4ea112084d4c50dc27f97329dfad5777a1
This commit is contained in:
@@ -54,8 +54,7 @@ def _get_endpoint(client, **kwargs):
|
||||
|
||||
|
||||
def get_client(api_version, **kwargs):
|
||||
"""Get an authenticated client, based on the credentials
|
||||
in the keyword args.
|
||||
"""Get an authenticated client, based on the credentials in args.
|
||||
|
||||
:param api_version: the API version to use. Valid value: '1'.
|
||||
:param kwargs: keyword args containing credentials, either:
|
||||
@@ -94,8 +93,8 @@ def get_client(api_version, **kwargs):
|
||||
else _ksclient.auth_token)
|
||||
|
||||
ks_kwargs['region_name'] = kwargs.get('os_region_name')
|
||||
endpoint = kwargs.get('ironic_url') or \
|
||||
_get_endpoint(_ksclient, **ks_kwargs)
|
||||
endpoint = (kwargs.get('ironic_url') or
|
||||
_get_endpoint(_ksclient, **ks_kwargs))
|
||||
|
||||
auth_ref = _ksclient.auth_ref
|
||||
|
||||
|
@@ -27,7 +27,9 @@ from ironicclient.openstack.common.apiclient import base
|
||||
|
||||
|
||||
def getid(obj):
|
||||
"""Abstracts the common pattern of allowing both an object or an
|
||||
"""Wrapper to get object's ID.
|
||||
|
||||
Abstracts the common pattern of allowing both an object or an
|
||||
object's ID (UUID) as a parameter when dealing with relationships.
|
||||
"""
|
||||
try:
|
||||
@@ -37,9 +39,7 @@ def getid(obj):
|
||||
|
||||
|
||||
class Manager(object):
|
||||
"""Managers interact with a particular type of API and provide CRUD
|
||||
operations for them.
|
||||
"""
|
||||
"""Provides CRUD operations with a particular API."""
|
||||
resource_class = None
|
||||
|
||||
def __init__(self, api):
|
||||
@@ -137,8 +137,9 @@ class Manager(object):
|
||||
|
||||
|
||||
class Resource(base.Resource):
|
||||
"""A resource represents a particular instance of an object (tenant, user,
|
||||
etc). This is pretty much just a bag for attributes.
|
||||
"""Represents a particular instance of an object (tenant, user, etc).
|
||||
|
||||
This is pretty much just a bag for attributes.
|
||||
"""
|
||||
|
||||
def to_dict(self):
|
||||
|
@@ -239,6 +239,7 @@ class VerifiedHTTPSConnection(six.moves.http_client.HTTPSConnection):
|
||||
|
||||
def connect(self):
|
||||
"""Connect to a host on a given (SSL) port.
|
||||
|
||||
If ca_file is pointing somewhere, use it to check Server Certificate.
|
||||
|
||||
Redefined/copied and extended from httplib.py:1105 (Python 2.6.x).
|
||||
|
@@ -54,9 +54,8 @@ def define_command(subparsers, command, callback, cmd_mapper):
|
||||
|
||||
|
||||
def define_commands_from_module(subparsers, command_module, cmd_mapper):
|
||||
'''Find all methods beginning with 'do_' in a module, and add them
|
||||
as commands into a subparsers collection.
|
||||
'''
|
||||
"""Add 'do_' methods in a module and add as commands into a subparsers."""
|
||||
|
||||
for method_name in (a for a in dir(command_module) if a.startswith('do_')):
|
||||
# Commands should be hypen-separated instead of underscores.
|
||||
command = method_name[3:].replace('_', '-')
|
||||
|
@@ -40,9 +40,7 @@ class InvalidAttribute(ClientException):
|
||||
|
||||
def from_response(response, message=None, traceback=None, method=None,
|
||||
url=None):
|
||||
"""Return an instance of an HttpError based on response from
|
||||
httplib/requests.
|
||||
"""
|
||||
"""Return an HttpError instance based on response from httplib/requests."""
|
||||
|
||||
error_body = {}
|
||||
if message:
|
||||
|
@@ -1,16 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
@@ -16,6 +16,7 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
|
||||
import six
|
||||
|
||||
from ironicclient.common import http
|
||||
@@ -68,8 +69,8 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
version=1,
|
||||
status=500)
|
||||
client = http.HTTPClient('http://localhost/')
|
||||
client.get_connection = \
|
||||
lambda *a, **kw: utils.FakeConnection(fake_resp)
|
||||
client.get_connection = (
|
||||
lambda *a, **kw: utils.FakeConnection(fake_resp))
|
||||
|
||||
error = self.assertRaises(exc.InternalServerError,
|
||||
client.json_request,
|
||||
@@ -84,8 +85,8 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
version=1,
|
||||
status=500)
|
||||
client = http.HTTPClient('http://localhost/')
|
||||
client.get_connection = \
|
||||
lambda *a, **kw: utils.FakeConnection(fake_resp)
|
||||
client.get_connection = (
|
||||
lambda *a, **kw: utils.FakeConnection(fake_resp))
|
||||
|
||||
error = self.assertRaises(exc.InternalServerError,
|
||||
client.json_request,
|
||||
@@ -94,16 +95,16 @@ class HttpClientTest(utils.BaseTestCase):
|
||||
|
||||
def test_server_exception_msg_and_traceback(self):
|
||||
error_msg = 'another test error'
|
||||
error_trace = "\"Traceback (most recent call last):\\n\\n " \
|
||||
"File \\\"/usr/local/lib/python2.7/..."
|
||||
error_trace = ("\"Traceback (most recent call last):\\n\\n "
|
||||
"File \\\"/usr/local/lib/python2.7/...")
|
||||
error_body = self._get_error_body(error_msg, error_trace)
|
||||
fake_resp = utils.FakeResponse({'content-type': 'application/json'},
|
||||
six.StringIO(error_body),
|
||||
version=1,
|
||||
status=500)
|
||||
client = http.HTTPClient('http://localhost/')
|
||||
client.get_connection = \
|
||||
lambda *a, **kw: utils.FakeConnection(fake_resp)
|
||||
client.get_connection = (
|
||||
lambda *a, **kw: utils.FakeConnection(fake_resp))
|
||||
|
||||
error = self.assertRaises(exc.InternalServerError,
|
||||
client.json_request,
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
|
||||
import fixtures
|
||||
import six
|
||||
import testtools
|
||||
@@ -69,7 +70,9 @@ class FakeConnection(object):
|
||||
class FakeResponse(object):
|
||||
def __init__(self, headers, body=None, version=None, status=None,
|
||||
reason=None):
|
||||
""":param headers: dict representing HTTP response headers
|
||||
"""Fake object to help testing.
|
||||
|
||||
:param headers: dict representing HTTP response headers
|
||||
:param body: file-like object
|
||||
"""
|
||||
self.headers = headers
|
||||
|
@@ -15,6 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
from testtools.matchers import HasLength
|
||||
|
@@ -1,16 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
@@ -216,8 +216,8 @@ def do_node_vendor_passthru(cc, args):
|
||||
metavar='<limit>',
|
||||
type=int,
|
||||
help='Maximum number of ports to return per request, '
|
||||
'0 for no limit. Default is the maximum number used '
|
||||
'by the Ironic API Service.')
|
||||
'0 for no limit. Default is the maximum number used '
|
||||
'by the Ironic API Service.')
|
||||
@cliutils.arg(
|
||||
'--marker',
|
||||
metavar='<marker>',
|
||||
|
@@ -28,12 +28,14 @@ COMMAND_MODULES = [
|
||||
|
||||
|
||||
def enhance_parser(parser, subparsers, cmd_mapper):
|
||||
'''Take a basic (nonversioned) parser and enhance it with
|
||||
"""Enhance parser with API version specific options.
|
||||
|
||||
Take a basic (nonversioned) parser and enhance it with
|
||||
commands and options specific for this version of API.
|
||||
|
||||
:param parser: top level parser :param subparsers: top level
|
||||
parser's subparsers collection where subcommands will go
|
||||
'''
|
||||
"""
|
||||
for command_module in COMMAND_MODULES:
|
||||
utils.define_commands_from_module(subparsers, command_module,
|
||||
cmd_mapper)
|
||||
|
@@ -5,7 +5,7 @@ Babel>=1.3
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
hacking>=0.8.0,<0.9
|
||||
hacking>=0.9.2,<0.10
|
||||
mock>=1.0
|
||||
oslosphinx>=2.2.0 # Apache-2.0
|
||||
python-subunit>=0.0.18
|
||||
|
Reference in New Issue
Block a user