Remove features deprecated in Stein

Change-Id: I9825df90c69233acaf3c712f371e33aaf2042d4c
This commit is contained in:
Dmitry Tantsur 2019-05-24 14:20:00 +02:00
parent 4920cc26a3
commit 0e7fa76b5a
4 changed files with 9 additions and 29 deletions

View File

@ -14,7 +14,6 @@
# limitations under the License.
import enum
import warnings
from metalsmith import _utils
@ -61,23 +60,6 @@ class InstanceState(enum.Enum):
"""Whether the state is considered healthy."""
return self in _HEALTHY_STATES
# TODO(dtantsur): remove before 1.0
def __eq__(self, other):
if isinstance(other, str):
warnings.warn("Comparing states with strings is deprecated, "
"use InstanceState instead", DeprecationWarning)
return self.value == other
else:
return super(InstanceState, self).__eq__(other)
def __ne__(self, other):
eq = self.__eq__(other)
return NotImplemented if eq is NotImplemented else not eq
def __hash__(self):
return hash(self.value)
_HEALTHY_STATES = frozenset([InstanceState.ACTIVE, InstanceState.DEPLOYING])
_DEPLOYED_STATES = frozenset([InstanceState.ACTIVE, InstanceState.MAINTENANCE])

View File

@ -15,7 +15,6 @@
import logging
import sys
import warnings
from openstack import connection
from openstack import exceptions as os_exc
@ -414,7 +413,7 @@ class Provisioner(_utils.GetNodeMixin):
return instance
def wait_for_provisioning(self, nodes, timeout=None, delay=None):
def wait_for_provisioning(self, nodes, timeout=None):
"""Wait for nodes to be provisioned.
Loops until all nodes finish provisioning.
@ -424,15 +423,11 @@ class Provisioner(_utils.GetNodeMixin):
:param timeout: How much time (in seconds) to wait for all nodes
to finish provisioning. If ``None`` (the default), wait forever
(more precisely, until the operation times out on server side).
:param delay: DEPRECATED, do not use.
:return: List of updated :py:class:`metalsmith.Instance` objects if
all succeeded.
:raises: :py:class:`metalsmith.exceptions.DeploymentFailure`
if the deployment failed or timed out for any nodes.
"""
if delay is not None:
warnings.warn("The delay argument to wait_for_provisioning is "
"deprecated and has not effect", DeprecationWarning)
nodes = [self._get_node(n, accept_hostname=True) for n in nodes]
nodes = self.connection.baremetal.wait_for_nodes_provision_state(
nodes, 'active', timeout=timeout)

View File

@ -158,8 +158,3 @@ class TestInstanceStates(test_provisioner.Base):
to_dict)
# States are converted to strings
self.assertIsInstance(to_dict['state'], six.string_types)
def test_deprecated_comparisons(self):
for item in _instance.InstanceState:
self.assertEqual(item, item.value)
self.assertFalse(item != item.value) # noqa

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
The deprecated ``delay`` argument to the ``wait_for_provisioning`` call
has been removed.
- |
Instance states (members of the ``InstanceState`` enumeration) can no
longer be compared to strings. This was deprecated in the Stein release.