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.
# 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()