Remove features deprecated in Stein
Change-Id: I9825df90c69233acaf3c712f371e33aaf2042d4c
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import enum
|
import enum
|
||||||
import warnings
|
|
||||||
|
|
||||||
from metalsmith import _utils
|
from metalsmith import _utils
|
||||||
|
|
||||||
@@ -61,23 +60,6 @@ class InstanceState(enum.Enum):
|
|||||||
"""Whether the state is considered healthy."""
|
"""Whether the state is considered healthy."""
|
||||||
return self in _HEALTHY_STATES
|
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])
|
_HEALTHY_STATES = frozenset([InstanceState.ACTIVE, InstanceState.DEPLOYING])
|
||||||
_DEPLOYED_STATES = frozenset([InstanceState.ACTIVE, InstanceState.MAINTENANCE])
|
_DEPLOYED_STATES = frozenset([InstanceState.ACTIVE, InstanceState.MAINTENANCE])
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
|
|
||||||
from openstack import connection
|
from openstack import connection
|
||||||
from openstack import exceptions as os_exc
|
from openstack import exceptions as os_exc
|
||||||
@@ -414,7 +413,7 @@ class Provisioner(_utils.GetNodeMixin):
|
|||||||
|
|
||||||
return instance
|
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.
|
"""Wait for nodes to be provisioned.
|
||||||
|
|
||||||
Loops until all nodes finish provisioning.
|
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
|
:param timeout: How much time (in seconds) to wait for all nodes
|
||||||
to finish provisioning. If ``None`` (the default), wait forever
|
to finish provisioning. If ``None`` (the default), wait forever
|
||||||
(more precisely, until the operation times out on server side).
|
(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
|
:return: List of updated :py:class:`metalsmith.Instance` objects if
|
||||||
all succeeded.
|
all succeeded.
|
||||||
:raises: :py:class:`metalsmith.exceptions.DeploymentFailure`
|
:raises: :py:class:`metalsmith.exceptions.DeploymentFailure`
|
||||||
if the deployment failed or timed out for any nodes.
|
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._get_node(n, accept_hostname=True) for n in nodes]
|
||||||
nodes = self.connection.baremetal.wait_for_nodes_provision_state(
|
nodes = self.connection.baremetal.wait_for_nodes_provision_state(
|
||||||
nodes, 'active', timeout=timeout)
|
nodes, 'active', timeout=timeout)
|
||||||
|
@@ -158,8 +158,3 @@ class TestInstanceStates(test_provisioner.Base):
|
|||||||
to_dict)
|
to_dict)
|
||||||
# States are converted to strings
|
# States are converted to strings
|
||||||
self.assertIsInstance(to_dict['state'], six.string_types)
|
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
|
|
||||||
|
@@ -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.
|
Reference in New Issue
Block a user