Raise hacking to 2.x

We have kept hacking capped below 1.2 for quite awhile. Newer versions
of hacking pull in updated linters that have some good checks.

We want to limit the maximum version of hacking installed since the
global upper constraints does not do this for linters. Otherwise when a
new release of hacking is available in the future, stable branches may
suddenly be broken.

Change-Id: I0e0ee8a169ae93f7efb2cda2b1d2458c1d49e46b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-03-26 05:40:28 -05:00 committed by Monty Taylor
parent 9764c46e7d
commit 8ca613e43f
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. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import typing
from openstack._log import enable_logging # noqa from openstack._log import enable_logging # noqa
import openstack.config import openstack.config
@ -24,8 +25,8 @@ __all__ = [
def connect( def connect(
cloud=None, cloud=None,
app_name=None, # type: Optional[str] app_name=None, # type: typing.Optional[str]
app_version=None, # type: Optional[str] app_version=None, # type: typing.Optional[str]
options=None, options=None,
load_yaml_config=True, # type: bool load_yaml_config=True, # type: bool
load_envvars=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: elif not abort_on_failed_state:
return False return False
if (self.provision_state.endswith(' failed') or if (self.provision_state.endswith(' failed')
self.provision_state == 'error'): or self.provision_state == 'error'):
raise exceptions.ResourceFailure( raise exceptions.ResourceFailure(
"Node %(node)s reached failure state \"%(state)s\"; " "Node %(node)s reached failure state \"%(state)s\"; "
"the last error is %(error)s" % "the last error is %(error)s" %

View File

@ -100,7 +100,7 @@ class DnsCloudMixin(_normalize.Normalizer):
try: try:
return self.dns.create_zone(**zone) return self.dns.create_zone(**zone)
except exceptions.SDKException as e: except exceptions.SDKException:
raise exc.OpenStackCloudException( raise exc.OpenStackCloudException(
"Unable to create zone {name}".format(name=name) "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 # side filter for user name https://bit.ly/2qh0Ijk
# especially important when using LDAP and using page to limit results # especially important when using LDAP and using page to limit results
if name_or_id and not _utils._is_uuid_like(name_or_id): 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) users = self.list_users(**kwargs)
return _utils._filter_list(users, name_or_id, filters) 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 self.config.get('profile') == 'rackspace'
and service_type == 'block-storage' and service_type == 'block-storage'
): ):
value = value + auth.get('project_id') value = value + auth.get('project_id')
return value return value
def get_endpoint_from_catalog( 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 :param floating_ip: The value can be the ID of the Floating IP that the
port forwarding belongs or a :class:`~openstack. port forwarding belongs or a :class:`~openstack.
network.v2.floating_ip.FloatingIP` instance. 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. the resources being returned.
:returns: A generator of floating ip port forwarding objects :returns: A generator of floating ip port forwarding objects
:rtype: :class:`~openstack.network.v2.port_forwarding. :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') \ with mock.patch('openstack.compute.v2.server.Server.create_image') \
as ci_mock: as ci_mock:
ci_mock.return_value = 'image_id' ci_mock.return_value = 'image_id'
connection_mock = mock.Mock() connection_mock = mock.Mock()
connection_mock.get_image = mock.Mock(return_value='image') connection_mock.get_image = mock.Mock(return_value='image')
connection_mock.wait_for_image = mock.Mock() connection_mock.wait_for_image = mock.Mock()
self.proxy._connection = connection_mock self.proxy._connection = connection_mock
rsp = self.proxy.create_server_image( rsp = self.proxy.create_server_image(
'server', 'image_name', metadata, wait=True, timeout=1) 'server', 'image_name', metadata, wait=True, timeout=1)
ci_mock.assert_called_with( ci_mock.assert_called_with(
self.proxy, self.proxy,
'image_name', 'image_name',
metadata metadata
) )
self.proxy._connection.get_image.assert_called_with('image_id') self.proxy._connection.get_image.assert_called_with('image_id')
self.proxy._connection.wait_for_image.assert_called_with( self.proxy._connection.wait_for_image.assert_called_with(
'image', 'image',
timeout=1) timeout=1)
self.assertEqual(connection_mock.wait_for_image(), rsp) self.assertEqual(connection_mock.wait_for_image(), rsp)
def test_server_group_create(self): def test_server_group_create(self):
self.verify_create(self.proxy.create_server_group, 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 # 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 # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # 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 coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT 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) service_description_class = getattr(service_description_module, class_name)
return service_description_class return service_description_class
make_names() make_names()