Merge "Raise hacking to 2.x"

This commit is contained in:
Zuul 2020-03-30 08:44:59 +00:00 committed by Gerrit Code Review
commit 9ce51f9c58
9 changed files with 28 additions and 26 deletions

View File

@ -11,6 +11,7 @@
# 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.
import typing
from openstack._log import enable_logging # noqa
import openstack.config
@ -24,8 +25,8 @@ __all__ = [
def connect(
cloud=None,
app_name=None, # type: Optional[str]
app_version=None, # type: Optional[str]
app_name=None, # type: typing.Optional[str]
app_version=None, # type: typing.Optional[str]
options=None,
load_yaml_config=True, # type: bool
load_envvars=True, # type: bool

View File

@ -515,8 +515,8 @@ class Node(_common.ListMixin, resource.Resource):
elif not abort_on_failed_state:
return False
if (self.provision_state.endswith(' failed') or
self.provision_state == 'error'):
if (self.provision_state.endswith(' failed')
or self.provision_state == 'error'):
raise exceptions.ResourceFailure(
"Node %(node)s reached failure state \"%(state)s\"; "
"the last error is %(error)s" %

View File

@ -100,7 +100,7 @@ class DnsCloudMixin(_normalize.Normalizer):
try:
return self.dns.create_zone(**zone)
except exceptions.SDKException as e:
except exceptions.SDKException:
raise exc.OpenStackCloudException(
"Unable to create zone {name}".format(name=name)
)

View File

@ -209,7 +209,7 @@ class IdentityCloudMixin(_normalize.Normalizer):
# side filter for user name https://bit.ly/2qh0Ijk
# especially important when using LDAP and using page to limit results
if name_or_id and not _utils._is_uuid_like(name_or_id):
kwargs['name'] = name_or_id
kwargs['name'] = name_or_id
users = self.list_users(**kwargs)
return _utils._filter_list(users, name_or_id, filters)

View File

@ -501,7 +501,7 @@ class CloudRegion(object):
and self.config.get('profile') == 'rackspace'
and service_type == 'block-storage'
):
value = value + auth.get('project_id')
value = value + auth.get('project_id')
return value
def get_endpoint_from_catalog(

View File

@ -3976,7 +3976,7 @@ class Proxy(proxy.Proxy):
:param floating_ip: The value can be the ID of the Floating IP that the
port forwarding belongs or a :class:`~openstack.
network.v2.floating_ip.FloatingIP` instance.
:param kwargs \*\*query: Optional query parameters to be sent to limit
:param kwargs **query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of floating ip port forwarding objects
:rtype: :class:`~openstack.network.v2.port_forwarding.

View File

@ -454,27 +454,27 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
with mock.patch('openstack.compute.v2.server.Server.create_image') \
as ci_mock:
ci_mock.return_value = 'image_id'
connection_mock = mock.Mock()
connection_mock.get_image = mock.Mock(return_value='image')
connection_mock.wait_for_image = mock.Mock()
self.proxy._connection = connection_mock
ci_mock.return_value = 'image_id'
connection_mock = mock.Mock()
connection_mock.get_image = mock.Mock(return_value='image')
connection_mock.wait_for_image = mock.Mock()
self.proxy._connection = connection_mock
rsp = self.proxy.create_server_image(
'server', 'image_name', metadata, wait=True, timeout=1)
rsp = self.proxy.create_server_image(
'server', 'image_name', metadata, wait=True, timeout=1)
ci_mock.assert_called_with(
self.proxy,
'image_name',
metadata
)
ci_mock.assert_called_with(
self.proxy,
'image_name',
metadata
)
self.proxy._connection.get_image.assert_called_with('image_id')
self.proxy._connection.wait_for_image.assert_called_with(
'image',
timeout=1)
self.proxy._connection.get_image.assert_called_with('image_id')
self.proxy._connection.wait_for_image.assert_called_with(
'image',
timeout=1)
self.assertEqual(connection_mock.wait_for_image(), rsp)
self.assertEqual(connection_mock.wait_for_image(), rsp)
def test_server_group_create(self):
self.verify_create(self.proxy.create_server_group,

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.0,<1.2 # Apache-2.0
hacking>=2.0,<2.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT

View File

@ -125,4 +125,5 @@ def _find_service_description_class(service_type):
service_description_class = getattr(service_description_module, class_name)
return service_description_class
make_names()