Remove all the deprecated stuff

We're really close to a 1.0 release. Let's go ahead and remove the stuff
that was marked deprecated and see what breaks.

Depends-On: https://review.openstack.org/610695
Change-Id: I0b1b7a0060a3cc0ac1772e5ef2d2a9673159cd77
This commit is contained in:
Monty Taylor 2018-09-26 13:42:41 -05:00
parent d75056a8be
commit 603ba0d7d9
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
28 changed files with 131 additions and 909 deletions

View File

@ -10,13 +10,6 @@ DEBUG = True if os.getenv("ENFORCER_DEBUG") else False
WRITTEN_METHODS = set()
# NOTE: This is temporary! These methods currently exist on the base
# Proxy class as public methods, but they're deprecated in favor of
# subclasses actually exposing them if necessary. However, as they're
# public and purposely undocumented, they cause spurious warnings.
# Ignore these methods until they're actually removed from the API,
# and then we can take this special case out.
IGNORED_METHODS = ("wait_for_delete", "wait_for_status")
class EnforcementError(errors.SphinxError):
"""A mismatch between what exists and what's documented"""
@ -52,10 +45,6 @@ def get_proxy_methods():
# We only document public names
names = [name for name in dir(instance) if not name.startswith("_")]
# Remove the wait_for_* names temporarily.
for name in IGNORED_METHODS:
names.remove(name)
good_names = [module.__name__ + ".Proxy." + name for name in names]
methods.update(good_names)
@ -104,16 +93,6 @@ def build_finished(app, exception):
app.info("ENFORCER: %d proxy methods written" % len(WRITTEN_METHODS))
missing = all_methods - WRITTEN_METHODS
def is_ignored(name):
for ignored_name in IGNORED_METHODS:
if ignored_name in name:
return True
return False
# TEMPORARY: Ignore the wait_for names when determining what is missing.
app.info("ENFORCER: Ignoring wait_for_* names...")
missing = set(x for x in missing if not is_ignored(x))
missing_count = len(missing)
app.info("ENFORCER: Found %d missing proxy methods "
"in the output" % missing_count)

View File

@ -123,23 +123,6 @@ RegionOne Ashburn, VA
* Images must be in `raw` format
* IPv6 is provided to every server
DreamHost
---------
Deprecated, please use dreamcompute
https://keystone.dream.io/v2.0
============== ================
Region Name Location
============== ================
RegionOne Ashburn, VA
============== ================
* Images must be in `raw` format
* Public IPv4 is provided via NAT with Neutron Floating IP
* IPv6 is provided to every server
Open Telekom Cloud
------------------

View File

@ -96,31 +96,31 @@ and destroy them before deleting the cluster object itself.
:pyobject: delete_cluster
Cluster Add Nodes
~~~~~~~~~~~~~~~~~
Add Nodes to Cluster
~~~~~~~~~~~~~~~~~~~~
Add some existing nodes into the specified cluster.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_add_nodes
:pyobject: add_nodes_to_cluster
Cluster Del Nodes
~~~~~~~~~~~~~~~~~
Remove Nodes from Cluster
~~~~~~~~~~~~~~~~~~~~~~~~~
Remove nodes from specified cluster.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_del_nodes
:pyobject: remove_nodes_from_cluster
Cluster Replace Nodes
~~~~~~~~~~~~~~~~~~~~~
Replace Nodes in Cluster
~~~~~~~~~~~~~~~~~~~~~~~~
Replace some existing nodes in the specified cluster.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_replace_nodes
:pyobject: replace_nodes_in_cluster
Cluster Scale Out
@ -129,7 +129,7 @@ Cluster Scale Out
Inflate the size of a cluster.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_scale_out
:pyobject: scale_out_cluster
Cluster Scale In
@ -138,7 +138,7 @@ Cluster Scale In
Shrink the size of a cluster.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_scale_in
:pyobject: scale_out_cluster
Cluster Resize
@ -147,28 +147,28 @@ Cluster Resize
Resize of cluster.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_resize
:pyobject: resize_cluster
Cluster Policy Attach
~~~~~~~~~~~~~~~~~~~~~
Attach Policy to Cluster
~~~~~~~~~~~~~~~~~~~~~~~~
Once a policy is attached (bound) to a cluster, it will be
enforced when related actions are performed on that cluster,
unless the policy is (temporarily) disabled on the cluster
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_attach_policy
:pyobject: attach_policy_to_cluster
Cluster Policy Detach
~~~~~~~~~~~~~~~~~~~~~
Detach Policy from Cluster
~~~~~~~~~~~~~~~~~~~~~~~~~~
Once a policy is attached to a cluster, it can be detached
from the cluster at user's request.
.. literalinclude:: ../../examples/clustering/cluster.py
:pyobject: cluster_detach_policy
:pyobject: detach_policy_from_cluster
Cluster Check

View File

@ -41,9 +41,10 @@ To log messages to a file called ``openstack.log`` and the console on
.. code-block:: python
import sys
from openstack import utils
import openstack
utils.enable_logging(debug=True, path='openstack.log', stream=sys.stdout)
openstack.enable_logging(
debug=True, path='openstack.log', stream=sys.stdout)
`openstack.enable_logging` also sets up a few other loggers and

View File

@ -73,15 +73,3 @@ VIF Operations
.. automethod:: openstack.baremetal.v1._proxy.Proxy.attach_vif_to_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.detach_vif_from_node
.. automethod:: openstack.baremetal.v1._proxy.Proxy.list_node_vifs
Deprecated Methods
^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.baremetal.v1._proxy.Proxy
.. automethod:: openstack.baremetal.v1._proxy.Proxy.create_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.update_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.delete_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.get_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.find_portgroup
.. automethod:: openstack.baremetal.v1._proxy.Proxy.portgroups

View File

@ -97,17 +97,6 @@ Cluster Operations
.. automethod:: openstack.clustering.v1._proxy.Proxy.get_cluster_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_policies
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_add_nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_attach_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_del_nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_detach_policy
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_operation
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_replace_nodes
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_resize
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_scale_in
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_scale_out
.. automethod:: openstack.clustering.v1._proxy.Proxy.cluster_update_policy
Node Operations
^^^^^^^^^^^^^^^
@ -126,7 +115,6 @@ Node Operations
.. automethod:: openstack.clustering.v1._proxy.Proxy.perform_operation_on_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.adopt_node
.. automethod:: openstack.clustering.v1._proxy.Proxy.node_operation
Receiver Operations

View File

@ -120,9 +120,6 @@ Security Group Operations
.. automethod:: openstack.network.v2._proxy.Proxy.security_group_rules
.. automethod:: openstack.network.v2._proxy.Proxy.security_groups
.. automethod:: openstack.network.v2._proxy.Proxy.security_group_allow_ping
.. automethod:: openstack.network.v2._proxy.Proxy.security_group_open_port
.. automethod:: openstack.network.v2._proxy.Proxy.create_security_group_rule
.. automethod:: openstack.network.v2._proxy.Proxy.delete_security_group_rule

View File

@ -1,4 +1,3 @@
Utilities
=========
.. automodule:: openstack.utils
:members: enable_logging

View File

@ -86,23 +86,23 @@ def delete_cluster(conn):
print("Cluster deleted")
def cluster_add_nodes(conn):
def add_nodes_to_cluster(conn):
print("Add nodes to cluster:")
node_ids = [NODE_ID]
res = conn.clustering.cluster_add_nodes(CLUSTER_ID, node_ids)
res = conn.clustering.add_nodes_to_cluster(CLUSTER_ID, node_ids)
print(res)
def cluster_del_nodes(conn):
def remove_nodes_from_cluster(conn):
print("Remove nodes from a cluster:")
node_ids = [NODE_ID]
res = conn.clustering.cluster_del_nodes(CLUSTER_ID, node_ids)
res = conn.clustering.remove_nodes_from_cluster(CLUSTER_ID, node_ids)
print(res)
def cluster_replace_nodes(conn):
def replace_nodes_in_cluster(conn):
print("Replace the nodes in a cluster with specified nodes:")
old_node = NODE_ID
@ -110,25 +110,25 @@ def cluster_replace_nodes(conn):
spec = {
old_node: new_node
}
res = conn.clustering.cluster_replace_nodes(CLUSTER_ID, **spec)
res = conn.clustering.replace_nodes_in_cluster(CLUSTER_ID, **spec)
print(res)
def cluster_scale_out(conn):
def scale_out_cluster(conn):
print("Inflate the size of a cluster:")
res = conn.clustering.cluster_scale_out(CLUSTER_ID, 1)
res = conn.clustering.scale_out_cluster(CLUSTER_ID, 1)
print(res)
def cluster_scale_in(conn):
def scale_in_cluster(conn):
print("Shrink the size of a cluster:")
res = conn.clustering.cluster_scale_in(CLUSTER_ID, 1)
res = conn.clustering.scale_in_cluster(CLUSTER_ID, 1)
print(res)
def cluster_resize(conn):
def resize_cluster(conn):
print("Resize of cluster:")
spec = {
@ -137,23 +137,23 @@ def cluster_resize(conn):
'adjustment_type': 'EXACT_CAPACITY',
'number': 2
}
res = conn.clustering.cluster_resize(CLUSTER_ID, **spec)
res = conn.clustering.resize_cluster(CLUSTER_ID, **spec)
print(res)
def cluster_attach_policy(conn):
def attach_policy_to_cluster(conn):
print("Attach policy to a cluster:")
spec = {'enabled': True}
res = conn.clustering.cluster_attach_policy(CLUSTER_ID, POLICY_ID,
**spec)
res = conn.clustering.attach_policy_to_cluster(
CLUSTER_ID, POLICY_ID, **spec)
print(res)
def cluster_detach_policy(conn):
def detach_policy_from_cluster(conn):
print("Detach a policy from a cluster:")
res = conn.clustering.cluster_detach_policy(CLUSTER_ID, POLICY_ID)
res = conn.clustering.detach_policy_from_cluster(CLUSTER_ID, POLICY_ID)
print(res)

View File

@ -21,10 +21,9 @@ import os
import openstack
from openstack.config import loader
from openstack import utils
import sys
utils.enable_logging(True, stream=sys.stdout)
openstack.enable_logging(True, stream=sys.stdout)
#: Defines the OpenStack Config loud key in your config file,
#: typically in $HOME/.config/openstack/clouds.yaml. That configuration

View File

@ -2,7 +2,6 @@ appdirs==1.3.0
coverage==4.0
cryptography==2.1
decorator==3.4.0
deprecation==1.0
dogpile.cache==0.6.2
extras==1.0.0
fixtures==3.0.0

View File

@ -484,47 +484,6 @@ class Proxy(proxy.Proxy):
"""
return self._delete(_port.Port, port, ignore_missing=ignore_missing)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use port_groups instead")
def portgroups(self, details=False, **query):
"""Retrieve a generator of port groups.
:param details: A boolean indicating whether the detailed information
for every portgroup should be returned.
:param dict query: Optional query parameters to be sent to restrict
the portgroups returned. Available parameters include:
* ``address``: Only return portgroups with the specified physical
hardware address, typically a MAC address.
* ``fields``: A list containing one or more fields to be returned
in the response. This may lead to some performance gain
because other fields of the resource are not refreshed.
* ``limit``: Requests at most the specified number of portgroups
returned from the query.
* ``marker``: Specifies the ID of the last-seen portgroup. Use the
``limit`` parameter to make an initial limited request and
use the ID of the last-seen portgroup from the response as
the ``marker`` value in a subsequent limited request.
* ``node``:only return the ones associated with this specific node
(name or UUID), or an empty set if not found.
* ``sort_dir``: Sorts the response by the requested sort direction.
A valid value is ``asc`` (ascending) or ``desc``
(descending). Default is ``asc``. You can specify multiple
pairs of sort key and sort direction query parameters. If
you omit the sort direction in a pair, the API uses the
natural sorting direction of the server attribute that is
provided as the ``sort_key``.
* ``sort_key``: Sorts the response by the this attribute value.
Default is ``id``. You can specify multiple pairs of sort
key and sort direction query parameters. If you omit the
sort direction in a pair, the API uses the natural sorting
direction of the server attribute that is provided as the
``sort_key``.
:returns: A generator of portgroup instances.
"""
return self.port_groups(details=details, **query)
def port_groups(self, details=False, **query):
"""Retrieve a generator of port groups.
@ -565,20 +524,6 @@ class Proxy(proxy.Proxy):
cls = _portgroup.PortGroupDetail if details else _portgroup.PortGroup
return self._list(cls, paginated=True, **query)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use create_port_group instead")
def create_portgroup(self, **attrs):
"""Create a new port group from attributes.
:param dict attrs: Keyword arguments that will be used to create a
:class:`~openstack.baremetal.v1.port_group.PortGroup`, it
comprises of the properties on the ``PortGroup`` class.
:returns: The results of portgroup creation.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`.
"""
return self.create_port_group(**attrs)
def create_port_group(self, **attrs):
"""Create a new portgroup from attributes.
@ -591,21 +536,6 @@ class Proxy(proxy.Proxy):
"""
return self._create(_portgroup.PortGroup, **attrs)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use find_port_group instead")
def find_portgroup(self, name_or_id, ignore_missing=True):
"""Find a single port group.
:param str name_or_id: The name or ID of a portgroup.
:param bool ignore_missing: When set to ``False``, an exception of
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the port group does not exist. When set to `True``, None will
be returned when attempting to find a nonexistent port group.
:returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup`
object or None.
"""
return self.find_port_group(name_or_id, ignore_missing=ignore_missing)
def find_port_group(self, name_or_id, ignore_missing=True):
"""Find a single port group.
@ -620,26 +550,6 @@ class Proxy(proxy.Proxy):
return self._find(_portgroup.PortGroup, name_or_id,
ignore_missing=ignore_missing)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use get_port_group instead")
def get_portgroup(self, portgroup, **query):
"""Get a specific port group.
:param portgroup: The value can be the name or ID of a chassis or a
:class:`~openstack.baremetal.v1.port_group.PortGroup` instance.
:param dict query: Optional query parameters to be sent to restrict
the portgroup properties returned. Available parameters include:
* ``fields``: A list containing one or more fields to be returned
in the response. This may lead to some performance gain
because other fields of the resource are not refreshed.
:returns: One :class:`~openstack.baremetal.v1.port_group.PortGroup`
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
port group matching the name or ID could be found.
"""
return self.get_port_group(portgroup, **query)
def get_port_group(self, port_group, **query):
"""Get a specific port group.
@ -658,22 +568,6 @@ class Proxy(proxy.Proxy):
"""
return self._get(_portgroup.PortGroup, port_group, **query)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use update_port_group instead")
def update_portgroup(self, portgroup, **attrs):
"""Update a port group.
:param chassis: Either the name or the ID of a port group or
an instance of
:class:`~openstack.baremetal.v1.port_group.PortGroup`.
:param dict attrs: The attributes to update on the port group
represented by the ``portgroup`` parameter.
:returns: The updated port group.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`
"""
return self.update_port_group(portgroup, **attrs)
def update_port_group(self, port_group, **attrs):
"""Update a port group.
@ -688,26 +582,6 @@ class Proxy(proxy.Proxy):
"""
return self._update(_portgroup.PortGroup, port_group, **attrs)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use delete_port_group instead")
def delete_portgroup(self, portgroup, ignore_missing=True):
"""Delete a port group.
:param portgroup: The value can be either the name or ID of a port
group or a
:class:`~openstack.baremetal.v1.port_group.PortGroup`
instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the port group could not be found. When set to ``True``, no
exception will be raised when attempting to delete a non-existent
port group.
:returns: The instance of the port group which was deleted.
:rtype: :class:`~openstack.baremetal.v1.port_group.PortGroup`.
"""
return self.delete_port_group(portgroup, ignore_missing=ignore_missing)
def delete_port_group(self, port_group, ignore_missing=True):
"""Delete a port group.

View File

@ -15,6 +15,7 @@ from openstack.block_storage.v2 import stats as _stats
from openstack.block_storage.v2 import type as _type
from openstack.block_storage.v2 import volume as _volume
from openstack import proxy
from openstack import resource
class Proxy(proxy.Proxy):
@ -195,3 +196,44 @@ class Proxy(proxy.Proxy):
:returns A generator of cinder Back-end storage pools objects
"""
return self._list(_stats.Pools, paginated=False)
def wait_for_status(self, res, status='ACTIVE', failures=None,
interval=2, wait=120):
"""Wait for a resource to be in a particular status.
:param res: The resource to wait on to reach the specified status.
The resource must have a ``status`` attribute.
:type resource: A :class:`~openstack.resource.Resource` object.
:param status: Desired status.
:param failures: Statuses that would be interpreted as failures.
:type failures: :py:class:`list`
:param interval: Number of seconds to wait before to consecutive
checks. Default to 2.
:param wait: Maximum number of seconds to wait before the change.
Default to 120.
:returns: The resource is returned on success.
:raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
to the desired status failed to occur in specified seconds.
:raises: :class:`~openstack.exceptions.ResourceFailure` if the resource
has transited to one of the failure statuses.
:raises: :class:`~AttributeError` if the resource does not have a
``status`` attribute.
"""
failures = ['Error'] if failures is None else failures
return resource.wait_for_status(
self, res, status, failures, interval, wait)
def wait_for_delete(self, res, interval=2, wait=120):
"""Wait for a resource to be deleted.
:param res: The resource to wait on to be deleted.
:type resource: A :class:`~openstack.resource.Resource` object.
:param interval: Number of seconds to wait before to consecutive
checks. Default to 2.
:param wait: Maximum number of seconds to wait before the change.
Default to 120.
:returns: The resource is returned on success.
:raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
to delete failed to occur in the specified seconds.
"""
return resource.wait_for_delete(self, res, interval, wait)

View File

@ -25,7 +25,6 @@ from openstack.clustering.v1 import receiver as _receiver
from openstack.clustering.v1 import service as _service
from openstack import proxy
from openstack import resource
from openstack import utils
class Proxy(proxy.Proxy):
@ -283,18 +282,6 @@ class Proxy(proxy.Proxy):
"""
return self._update(_cluster.Cluster, cluster, **attrs)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use add_nodes_to_cluster instead")
def cluster_add_nodes(self, cluster, nodes):
"""Add nodes to a cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param nodes: List of nodes to be added to the cluster.
:returns: A dict containing the action initiated by this operation.
"""
return self.add_nodes_to_cluster(cluster, nodes)
def add_nodes_to_cluster(self, cluster, nodes):
"""Add nodes to a cluster.
@ -309,23 +296,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.add_nodes(self, nodes)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use remove_nodes_from_cluster instead")
def cluster_del_nodes(self, cluster, nodes, **params):
"""Remove nodes from a cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param nodes: List of nodes to be removed from the cluster.
:param kwargs \*\*params: Optional query parameters to be sent to
restrict the nodes to be returned. Available parameters include:
* destroy_after_deletion: A boolean value indicating whether the
deleted nodes to be destroyed right away.
:returns: A dict containing the action initiated by this operation.
"""
return self.remove_nodes_from_cluster(cluster, nodes, **params)
def remove_nodes_from_cluster(self, cluster, nodes, **params):
"""Remove nodes from a cluster.
@ -345,18 +315,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.del_nodes(self, nodes, **params)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use replace_nodes_in_cluster instead")
def cluster_replace_nodes(self, cluster, nodes):
"""Replace the nodes in a cluster with specified nodes.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param nodes: List of nodes to be deleted/added to the cluster.
:returns: A dict containing the action initiated by this operation.
"""
return self.replace_nodes_in_cluster(cluster, nodes)
def replace_nodes_in_cluster(self, cluster, nodes):
"""Replace the nodes in a cluster with specified nodes.
@ -371,19 +329,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.replace_nodes(self, nodes)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use scale_out_cluster instead")
def cluster_scale_out(self, cluster, count=None):
"""Inflate the size of a cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param count: Optional parameter specifying the number of nodes to
be added.
:returns: A dict containing the action initiated by this operation.
"""
return self.scale_out_cluster(cluster, count)
def scale_out_cluster(self, cluster, count=None):
"""Inflate the size of a cluster.
@ -399,19 +344,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.scale_out(self, count)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use scale_in_cluster instead")
def cluster_scale_in(self, cluster, count=None):
"""Shrink the size of a cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param count: Optional parameter specifying the number of nodes to
be removed.
:returns: A dict containing the action initiated by this operation.
"""
return self.scale_in_cluster(cluster, count)
def scale_in_cluster(self, cluster, count=None):
"""Shrink the size of a cluster.
@ -427,19 +359,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.scale_in(self, count)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use resize_cluster instead")
def cluster_resize(self, cluster, **params):
"""Resize of cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param dict \*\*params: A dictionary providing the parameters for the
resize action.
:returns: A dict containing the action initiated by this operation.
"""
return self.resize_cluster(cluster, **params)
def resize_cluster(self, cluster, **params):
"""Resize of cluster.
@ -455,20 +374,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.resize(self, **params)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use attach_policy_to_cluster instead")
def cluster_attach_policy(self, cluster, policy, **params):
"""Attach a policy to a cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy.
:param dict \*\*params: A dictionary containing the properties for the
policy to be attached.
:returns: A dict containing the action initiated by this operation.
"""
return self.attach_policy_to_cluster(cluster, policy, **params)
def attach_policy_to_cluster(self, cluster, policy, **params):
"""Attach a policy to a cluster.
@ -485,18 +390,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.policy_attach(self, policy, **params)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use detach_policy_from_cluster instead")
def cluster_detach_policy(self, cluster, policy):
"""Detach a policy from a cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy.
:returns: A dict containing the action initiated by this operation.
"""
return self.detach_policy_from_cluster(cluster, policy)
def detach_policy_from_cluster(self, cluster, policy):
"""Detach a policy from a cluster.
@ -511,20 +404,6 @@ class Proxy(proxy.Proxy):
obj = self._find(_cluster.Cluster, cluster, ignore_missing=False)
return obj.policy_detach(self, policy)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use update_cluster_policy instead")
def cluster_update_policy(self, cluster, policy, **params):
"""Change properties of a policy which is bound to the cluster.
:param cluster: Either the name or the ID of the cluster, or an
instance of :class:`~openstack.clustering.v1.cluster.Cluster`.
:param policy: Either the name or the ID of a policy.
:param dict \*\*params: A dictionary containing the new properties for
the policy.
:returns: A dict containing the action initiated by this operation.
"""
return self.update_cluster_policy(cluster, policy, **params)
def update_cluster_policy(self, cluster, policy, **params):
"""Change properties of a policy which is bound to the cluster.
@ -579,21 +458,6 @@ class Proxy(proxy.Proxy):
obj = self._get_resource(_cluster.Cluster, cluster)
return obj.recover(self, **params)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use perform_operation_on_cluster instead")
def cluster_operation(self, cluster, operation, **params):
"""Perform an operation on the specified cluster.
:param cluster: The value can be either the ID of a cluster or a
:class:`~openstack.clustering.v1.cluster.Cluster` instance.
:param operation: A string specifying the operation to be performed.
:param dict params: A dictionary providing the parameters for the
operation.
:returns: A dictionary containing the action ID.
"""
return self.perform_operation_on_cluster(cluster, operation, **params)
def perform_operation_on_cluster(self, cluster, operation, **params):
"""Perform an operation on the specified cluster.
@ -773,21 +637,6 @@ class Proxy(proxy.Proxy):
node = self._get_resource(_node.Node, None)
return node.adopt(self, preview=preview, **attrs)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="Use perform_operation_on_node instead")
def node_operation(self, node, operation, **params):
"""Perform an operation on the specified node.
:param node: The value can be either the ID of a node or a
:class:`~openstack.clustering.v1.node.Node` instance.
:param operation: A string specifying the operation to be performed.
:param dict params: A dictionary providing the parameters for the
operation.
:returns: A dictionary containing the action ID.
"""
return self.perform_operation_on_node(node, operation, **params)
def perform_operation_on_node(self, node, operation, **params):
"""Perform an operation on the specified node.

View File

@ -692,8 +692,29 @@ class Proxy(proxy.Proxy):
server = self._get_resource(_server.Server, server)
return server.get_console_output(self, length=length)
def wait_for_server(self, server, status='ACTIVE', failures=['ERROR'],
def wait_for_server(self, server, status='ACTIVE', failures=None,
interval=2, wait=120):
"""Wait for a server to be in a particular status.
:param res: The resource to wait on to reach the specified status.
The resource must have a ``status`` attribute.
:type resource: A :class:`~openstack.resource.Resource` object.
:param status: Desired status.
:param failures: Statuses that would be interpreted as failures.
:type failures: :py:class:`list`
:param interval: Number of seconds to wait before to consecutive
checks. Default to 2.
:param wait: Maximum number of seconds to wait before the change.
Default to 120.
:returns: The resource is returned on success.
:raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
to the desired status failed to occur in specified seconds.
:raises: :class:`~openstack.exceptions.ResourceFailure` if the resource
has transited to one of the failure statuses.
:raises: :class:`~AttributeError` if the resource does not have a
``status`` attribute.
"""
failures = ['ERROR'] if failures is None else failures
return resource.wait_for_status(
self, server, status, failures, interval, wait)
@ -1195,3 +1216,18 @@ class Proxy(proxy.Proxy):
self, host,
force=force,
block_migration=block_migration)
def wait_for_delete(self, res, interval=2, wait=120):
"""Wait for a resource to be deleted.
:param res: The resource to wait on to be deleted.
:type resource: A :class:`~openstack.resource.Resource` object.
:param interval: Number of seconds to wait before to consecutive
checks. Default to 2.
:param wait: Maximum number of seconds to wait before the change.
Default to 120.
:returns: The resource is returned on success.
:raises: :class:`~openstack.exceptions.ResourceTimeout` if transition
to delete failed to occur in the specified seconds.
"""
return resource.wait_for_delete(self, res, interval, wait)

View File

@ -1,13 +0,0 @@
{
"name": "dreamhost",
"profile": {
"status": "deprecated",
"message": "The dreamhost profile is deprecated. Please use the dreamcompute profile instead",
"auth": {
"auth_url": "https://keystone.dream.io"
},
"identity_api_version": "3",
"region_name": "RegionOne",
"image_format": "raw"
}
}

View File

@ -53,7 +53,6 @@ from openstack.network.v2 import subnet_pool as _subnet_pool
from openstack.network.v2 import trunk as _trunk
from openstack.network.v2 import vpn_service as _vpn_service
from openstack import proxy
from openstack import utils
class Proxy(proxy.Proxy):
@ -2870,34 +2869,6 @@ class Proxy(proxy.Proxy):
return self._update(_security_group.SecurityGroup, security_group,
**attrs)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="See the Network user guide for an example")
def security_group_open_port(self, sgid, port, protocol='tcp'):
rule = {
'direction': 'ingress',
'remote_ip_prefix': '0.0.0.0/0',
'protocol': protocol,
'port_range_max': port,
'port_range_min': port,
'security_group_id': sgid,
'ethertype': 'IPv4'
}
return self.create_security_group_rule(**rule)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details="See the Network user guide for an example")
def security_group_allow_ping(self, sgid):
rule = {
'direction': 'ingress',
'remote_ip_prefix': '0.0.0.0/0',
'protocol': 'icmp',
'port_range_max': None,
'port_range_min': None,
'security_group_id': sgid,
'ethertype': 'IPv4'
}
return self.create_security_group_rule(**rule)
def create_security_group_rule(self, **attrs):
"""Create a new security group rule from attributes

View File

@ -16,7 +16,6 @@ from openstack import _adapter
from openstack._meta import proxy as _meta
from openstack import exceptions
from openstack import resource
from openstack import utils
# The _check_resource decorator is used on Proxy methods to ensure that
@ -263,61 +262,3 @@ class Proxy(six.with_metaclass(_meta.ProxyMeta, _adapter.OpenStackSDKAdapter)):
"""
res = self._get_resource(resource_type, value, **attrs)
return res.head(self)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details=("This is no longer a part of the proxy base, "
"service-specific subclasses should expose "
"this as needed. See resource.wait_for_status "
"for this behavior"))
def wait_for_status(self, value, status, failures=None, interval=2,
wait=120):
"""Wait for a resource to be in a particular status.
:param value: The resource to wait on to reach the status. The
resource must have a status attribute.
:type value: :class:`~openstack.resource.Resource`
:param status: Desired status of the resource.
:param list failures: Statuses that would indicate the transition
failed such as 'ERROR'.
:param interval: Number of seconds to wait between checks.
:param wait: Maximum number of seconds to wait for the change.
:return: Method returns resource on success.
:raises: :class:`~openstack.exceptions.ResourceTimeout` transition
to status failed to occur in wait seconds.
:raises: :class:`~openstack.exceptions.ResourceFailure` resource
transitioned to one of the failure states.
:raises: :class:`~AttributeError` if the resource does not have a
status attribute
"""
failures = [] if failures is None else failures
return resource.wait_for_status(
self, value, status, failures, interval, wait)
@utils.deprecated(deprecated_in="0.9.14", removed_in="1.0",
details=("This is no longer a part of the proxy base, "
"service-specific subclasses should expose "
"this as needed. See resource.wait_for_delete "
"for this behavior"))
def wait_for_delete(self, value, interval=2, wait=120):
"""Wait for the resource to be deleted.
:param value: The resource to wait on to be deleted.
:type value: :class:`~openstack.resource.Resource`
:param interval: Number of seconds to wait between checks.
:param wait: Maximum number of seconds to wait for the delete.
:return: Method returns resource on success.
:raises: :class:`~openstack.exceptions.ResourceTimeout` transition
to delete failed to occur in wait seconds.
"""
return resource.wait_for_delete(self, value, interval, wait)
class BaseProxy(Proxy):
# Backwards compat wrapper
@utils.deprecated(deprecated_in="0.11.1", removed_in="1.0",
details="Use openstack.proxy.Proxy instead")
def __init__(self, *args, **kwargs):
super(BaseProxy, self).__init__(*args, **kwargs)

View File

@ -1,23 +0,0 @@
# Copyright 2018 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, 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.
from openstack import proxy
from openstack import utils
class Proxy(proxy.Proxy):
@utils.deprecated(deprecated_in="0.10.0", removed_in="1.0",
details="openstack.proxy2 is now openstack.proxy")
def __init__(self, *args, **kwargs):
super(Proxy, self).__init__(*args, **kwargs)

View File

@ -1,23 +0,0 @@
# Copyright 2018 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, 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.
from openstack import resource
from openstack import utils
class Resource(resource.Resource):
@utils.deprecated(deprecated_in="0.10.0", removed_in="1.0",
details="openstack.resource2 is now openstack.resource")
def __init__(self, *args, **kwargs):
super(Resource, self).__init__(*args, **kwargs)

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import deprecation
import mock
from openstack.baremetal.v1 import _proxy
@ -18,7 +17,6 @@ from openstack.baremetal.v1 import chassis
from openstack.baremetal.v1 import driver
from openstack.baremetal.v1 import node
from openstack.baremetal.v1 import port
from openstack.baremetal.v1 import port_group
from openstack import exceptions
from openstack.tests.unit import base
from openstack.tests.unit import test_proxy_base
@ -126,46 +124,6 @@ class TestBaremetalProxy(test_proxy_base.TestProxyBase):
def test_delete_port_ignore(self):
self.verify_delete(self.proxy.delete_port, port.Port, True)
@deprecation.fail_if_not_removed
def test_portgroups_detailed(self):
self.verify_list(self.proxy.portgroups, port_group.PortGroupDetail,
paginated=True,
method_kwargs={"details": True, "query": 1},
expected_kwargs={"query": 1})
@deprecation.fail_if_not_removed
def test_portgroups_not_detailed(self):
self.verify_list(self.proxy.portgroups, port_group.PortGroup,
paginated=True,
method_kwargs={"details": False, "query": 1},
expected_kwargs={"query": 1})
@deprecation.fail_if_not_removed
def test_create_portgroup(self):
self.verify_create(self.proxy.create_portgroup, port_group.PortGroup)
@deprecation.fail_if_not_removed
def test_find_portgroup(self):
self.verify_find(self.proxy.find_portgroup, port_group.PortGroup)
@deprecation.fail_if_not_removed
def test_get_portgroup(self):
self.verify_get(self.proxy.get_portgroup, port_group.PortGroup)
@deprecation.fail_if_not_removed
def test_update_portgroup(self):
self.verify_update(self.proxy.update_portgroup, port_group.PortGroup)
@deprecation.fail_if_not_removed
def test_delete_portgroup(self):
self.verify_delete(self.proxy.delete_portgroup, port_group.PortGroup,
False)
@deprecation.fail_if_not_removed
def test_delete_portgroup_ignore(self):
self.verify_delete(self.proxy.delete_portgroup, port_group.PortGroup,
True)
@mock.patch('time.sleep', lambda _sec: None)
@mock.patch.object(_proxy.Proxy, 'get_node', autospec=True)

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import deprecation
import mock
from openstack.clustering.v1 import _proxy
@ -114,201 +113,31 @@ class TestClusterProxy(test_proxy_base.TestProxyBase):
def test_cluster_update(self):
self.verify_update(self.proxy.update_cluster, cluster.Cluster)
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_add_nodes(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.add_nodes",
self.proxy.cluster_add_nodes,
method_args=["FAKE_CLUSTER", ["node1"]],
expected_args=[["node1"]])
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_add_nodes_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.add_nodes",
self.proxy.cluster_add_nodes,
method_args=[mock_cluster, ["node1"]],
expected_args=[["node1"]])
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_del_nodes(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.del_nodes",
self.proxy.cluster_del_nodes,
method_args=["FAKE_CLUSTER", ["node1"]],
expected_args=[["node1"]])
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_del_nodes_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.del_nodes",
self.proxy.cluster_del_nodes,
method_args=[mock_cluster, ["node1"]],
method_kwargs={"key": "value"},
expected_args=[["node1"]],
expected_kwargs={"key": "value"})
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_replace_nodes(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.replace_nodes",
self.proxy.cluster_replace_nodes,
method_args=["FAKE_CLUSTER", {"node1": "node2"}],
expected_args=[{"node1": "node2"}])
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_replace_nodes_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.replace_nodes",
self.proxy.cluster_replace_nodes,
method_args=[mock_cluster, {"node1": "node2"}],
expected_args=[{"node1": "node2"}])
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_scale_out(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.scale_out",
self.proxy.cluster_scale_out,
method_args=["FAKE_CLUSTER", 3],
expected_args=[3])
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_scale_out_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.scale_out",
self.proxy.cluster_scale_out,
method_args=[mock_cluster, 5],
expected_args=[5])
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_scale_in(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.scale_in",
self.proxy.cluster_scale_in,
method_args=["FAKE_CLUSTER", 3],
expected_args=[3])
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_scale_in_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.scale_in",
self.proxy.cluster_scale_in,
method_args=[mock_cluster, 5],
expected_args=[5])
def test_services(self):
self.verify_list(self.proxy.services,
service.Service,
paginated=False)
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_resize(self, mock_find):
def test_resize_cluster(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.resize",
self.proxy.cluster_resize,
self.proxy.resize_cluster,
method_args=["FAKE_CLUSTER"],
method_kwargs={'k1': 'v1', 'k2': 'v2'},
expected_kwargs={'k1': 'v1', 'k2': 'v2'})
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
def test_cluster_resize_with_obj(self):
def test_resize_cluster_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.resize",
self.proxy.cluster_resize,
self.proxy.resize_cluster,
method_args=[mock_cluster],
method_kwargs={'k1': 'v1', 'k2': 'v2'},
expected_kwargs={'k1': 'v1', 'k2': 'v2'})
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_attach_policy(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.policy_attach",
self.proxy.cluster_attach_policy,
method_args=["FAKE_CLUSTER", "FAKE_POLICY"],
method_kwargs={"k1": "v1", "k2": "v2"},
expected_args=["FAKE_POLICY"],
expected_kwargs={"k1": "v1", 'k2': "v2"})
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_attach_policy_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.policy_attach",
self.proxy.cluster_attach_policy,
method_args=[mock_cluster, "FAKE_POLICY"],
method_kwargs={"k1": "v1", "k2": "v2"},
expected_args=["FAKE_POLICY"],
expected_kwargs={"k1": "v1", 'k2': "v2"})
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_detach_policy(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.policy_detach",
self.proxy.cluster_detach_policy,
method_args=["FAKE_CLUSTER", "FAKE_POLICY"],
expected_args=["FAKE_POLICY"])
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_detach_policy_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.policy_detach",
self.proxy.cluster_detach_policy,
method_args=[mock_cluster, "FAKE_POLICY"],
expected_args=["FAKE_POLICY"])
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_find')
def test_cluster_update_policy(self, mock_find):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_find.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.policy_update",
self.proxy.cluster_update_policy,
method_args=["FAKE_CLUSTER", "FAKE_POLICY"],
method_kwargs={"k1": "v1", "k2": "v2"},
expected_args=["FAKE_POLICY"],
expected_kwargs={"k1": "v1", 'k2': "v2"})
mock_find.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER",
ignore_missing=False)
@deprecation.fail_if_not_removed
def test_cluster_update_policy_with_obj(self):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
self._verify("openstack.clustering.v1.cluster.Cluster.policy_update",
self.proxy.cluster_update_policy,
method_args=[mock_cluster, "FAKE_POLICY"],
method_kwargs={"k1": "v1", "k2": "v2"},
expected_args=["FAKE_POLICY"],
expected_kwargs={"k1": "v1", 'k2': "v2"})
def test_collect_cluster_attrs(self):
self.verify_list(self.proxy.collect_cluster_attrs,
cluster_attr.ClusterAttr, paginated=False,
@ -334,17 +163,6 @@ class TestClusterProxy(test_proxy_base.TestProxyBase):
method_args=["FAKE_CLUSTER"])
mock_get.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER")
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_get_resource')
def test_cluster_operation(self, mock_get):
mock_cluster = cluster.Cluster.new(id='FAKE_CLUSTER')
mock_get.return_value = mock_cluster
self._verify("openstack.clustering.v1.cluster.Cluster.op",
self.proxy.cluster_operation,
method_args=["FAKE_CLUSTER", "dance"],
expected_args=["dance"])
mock_get.assert_called_once_with(cluster.Cluster, "FAKE_CLUSTER")
def test_node_create(self):
self.verify_create(self.proxy.create_node, node.Node)
@ -423,17 +241,6 @@ class TestClusterProxy(test_proxy_base.TestProxyBase):
mock_get.assert_called_once_with(node.Node, None)
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_get_resource')
def test_node_operation(self, mock_get):
mock_node = node.Node.new(id='FAKE_CLUSTER')
mock_get.return_value = mock_node
self._verify("openstack.clustering.v1.node.Node.op",
self.proxy.node_operation,
method_args=["FAKE_NODE", "dance"],
expected_args=["dance"])
mock_get.assert_called_once_with(node.Node, "FAKE_NODE")
def test_policy_create(self):
self.verify_create(self.proxy.create_policy, policy.Policy)
@ -576,15 +383,3 @@ class TestClusterProxy(test_proxy_base.TestProxyBase):
self.proxy.wait_for_delete(mock_resource, 1, 2)
mock_wait.assert_called_once_with(self.proxy, mock_resource, 1, 2)
@deprecation.fail_if_not_removed
@mock.patch.object(proxy_base.Proxy, '_get_resource')
def test_profile_type_ops(self, mock_get):
mock_profile = profile_type.ProfileType.new(id='FAKE_PROFILE')
mock_get.return_value = mock_profile
self._verify(
"openstack.clustering.v1.profile_type.ProfileType.type_ops",
self.proxy.list_profile_type_operations,
method_args=["FAKE_PROFILE"])
mock_get.assert_called_once_with(profile_type.ProfileType,
"FAKE_PROFILE")

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import deprecation
import mock
import uuid
@ -992,49 +991,6 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.verify_update(self.proxy.update_security_group,
security_group.SecurityGroup)
@deprecation.fail_if_not_removed
def test_security_group_open_port(self):
mock_class = 'openstack.network.v2._proxy.Proxy'
mock_method = mock_class + '.create_security_group_rule'
expected_result = 'result'
sgid = 1
port = 2
with mock.patch(mock_method) as mocked:
mocked.return_value = expected_result
actual = self.proxy.security_group_open_port(sgid, port)
self.assertEqual(expected_result, actual)
expected_args = {
'direction': 'ingress',
'protocol': 'tcp',
'remote_ip_prefix': '0.0.0.0/0',
'port_range_max': port,
'security_group_id': sgid,
'port_range_min': port,
'ethertype': 'IPv4',
}
mocked.assert_called_with(**expected_args)
@deprecation.fail_if_not_removed
def test_security_group_allow_ping(self):
mock_class = 'openstack.network.v2._proxy.Proxy'
mock_method = mock_class + '.create_security_group_rule'
expected_result = 'result'
sgid = 1
with mock.patch(mock_method) as mocked:
mocked.return_value = expected_result
actual = self.proxy.security_group_allow_ping(sgid)
self.assertEqual(expected_result, actual)
expected_args = {
'direction': 'ingress',
'protocol': 'icmp',
'remote_ip_prefix': '0.0.0.0/0',
'port_range_max': None,
'security_group_id': sgid,
'port_range_min': None,
'ethertype': 'IPv4',
}
mocked.assert_called_with(**expected_args)
def test_security_group_rule_create_attrs(self):
self.verify_create(self.proxy.create_security_group_rule,
security_group_rule.SecurityGroupRule)

View File

@ -397,42 +397,3 @@ class TestProxyHead(base.TestCase):
HeadableResource.new.assert_called_with(id=self.fake_id)
self.res.head.assert_called_with(self.sot)
self.assertEqual(rv, self.fake_result)
class TestProxyWaits(base.TestCase):
def setUp(self):
super(TestProxyWaits, self).setUp()
self.session = mock.Mock()
self.sot = proxy.Proxy(self.session)
@mock.patch("openstack.resource.wait_for_status")
def test_wait_for(self, mock_wait):
mock_resource = mock.Mock()
mock_wait.return_value = mock_resource
self.sot.wait_for_status(mock_resource, 'ACTIVE')
mock_wait.assert_called_once_with(
self.sot, mock_resource, 'ACTIVE', [], 2, 120)
@mock.patch("openstack.resource.wait_for_status")
def test_wait_for_params(self, mock_wait):
mock_resource = mock.Mock()
mock_wait.return_value = mock_resource
self.sot.wait_for_status(mock_resource, 'ACTIVE', ['ERROR'], 1, 2)
mock_wait.assert_called_once_with(
self.sot, mock_resource, 'ACTIVE', ['ERROR'], 1, 2)
@mock.patch("openstack.resource.wait_for_delete")
def test_wait_for_delete(self, mock_wait):
mock_resource = mock.Mock()
mock_wait.return_value = mock_resource
self.sot.wait_for_delete(mock_resource)
mock_wait.assert_called_once_with(self.sot, mock_resource, 2, 120)
@mock.patch("openstack.resource.wait_for_delete")
def test_wait_for_delete_params(self, mock_wait):
mock_resource = mock.Mock()
mock_wait.return_value = mock_resource
self.sot.wait_for_delete(mock_resource, 1, 2)
mock_wait.assert_called_once_with(self.sot, mock_resource, 1, 2)

View File

@ -17,6 +17,7 @@ from openstack.tests.unit import base
import fixtures
import openstack
from openstack import utils
@ -53,7 +54,7 @@ class Test_enable_logging(base.TestCase):
def _console_tests(self, level, debug, stream):
utils.enable_logging(debug=debug, stream=stream)
openstack.enable_logging(debug=debug, stream=stream)
self.assertEqual(self.openstack_logger.addHandler.call_count, 1)
self.openstack_logger.setLevel.assert_called_with(level)
@ -64,14 +65,14 @@ class Test_enable_logging(base.TestCase):
fixtures.MonkeyPatch('logging.FileHandler', file_handler))
fake_path = "fake/path.log"
utils.enable_logging(debug=debug, path=fake_path)
openstack.enable_logging(debug=debug, path=fake_path)
file_handler.assert_called_with(fake_path)
self.assertEqual(self.openstack_logger.addHandler.call_count, 1)
self.openstack_logger.setLevel.assert_called_with(level)
def test_none(self):
utils.enable_logging(debug=True)
openstack.enable_logging(debug=True)
self.fake_get_logger.assert_has_calls([])
self.openstack_logger.setLevel.assert_called_with(logging.DEBUG)
self.assertEqual(self.openstack_logger.addHandler.call_count, 1)

View File

@ -10,54 +10,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import functools
import string
import time
import deprecation
import keystoneauth1
from keystoneauth1 import discover
from openstack import _log
from openstack import exceptions
from openstack import version
def deprecated(deprecated_in=None, removed_in=None,
details=""):
"""Mark a method as deprecated
:param deprecated_in: The version string where this method is deprecated.
Generally this is the next version to be released.
:param removed_in: The version where this method will be removed
from the code base. Generally this is the next
major version. This argument is helpful for the
tests when using ``deprecation.fail_if_not_removed``.
:param str details: Helpful details to callers and the documentation.
This will usually be a recommendation for alternate
code to use.
"""
# As all deprecations within this library have the same current_version,
# return a partial function with the library version always set.
partial = functools.partial(deprecation.deprecated,
current_version=version.__version__)
# TODO(shade) shade's tags break these - so hard override them for now.
# We'll want a patch fixing this before we cut any releases.
removed_in = '2.0.0'
return partial(deprecated_in=deprecated_in, removed_in=removed_in,
details=details)
@deprecated(deprecated_in="0.10.0", removed_in="1.0",
details="Use openstack.enable_logging instead")
def enable_logging(*args, **kwargs):
"""Backwards compatibility wrapper function.
openstacksdk has had enable_logging in utils. It's in _log now and
exposed directly at openstack.enable_logging.
"""
return _log.enable_logging(*args, **kwargs)
def urljoin(*args):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
In anticipation of the upcoming 1.0 release, all the things that have been
marked as deprecated have been removed.

View File

@ -9,7 +9,6 @@ jsonpatch!=1.20,>=1.16 # BSD
six>=1.10.0 # MIT
os-service-types>=1.2.0 # Apache-2.0
keystoneauth1>=3.11.0 # Apache-2.0
deprecation>=1.0 # Apache-2.0
munch>=2.1.0 # MIT
decorator>=3.4.0 # BSD