summaryrefslogtreecommitdiff
path: root/troveclient/v1
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem@us.ibm.com>2016-03-08 18:05:47 +0000
committerMatt Riedemann <mriedem@us.ibm.com>2016-03-08 20:12:31 -0500
commit3c71e52b408bbd6c33fca85188db2c8f156fb341 (patch)
treeb96aed550a3ab211708cf0f072bb4c82b7a22cb1 /troveclient/v1
parent9165c47123255fc76e86901117d9591226d5f992 (diff)
downloadpython-troveclient-3c71e52b408bbd6c33fca85188db2c8f156fb341.tar.gz
Revert "Time to get rid of any last vestiges of slave_of"2.1.1
This reverts commit a5234f0a07230e0d8195687e033adfe4cc0ad522 The change broke trove on stable/liberty since it's a backward incompatible change. To avoid capping python-troveclient<2.1.0 in stable/liberty global-requirements, we have to revert this change, blacklist the 2.1.0 version in g-r master and stable/liberty, and then release 2.2.0. And the slave_of code can't be removed until the last supported stable branch that uses it is end of life, which is liberty-eol. For now we keep the slave_of argument in the instance.create method, but emit a deprecation warning if it's specified, and we never pass it to the trove API for the create or edit operations since the API removed slave_of in 0c94a5bae0aacff7fde9a9742b7d526096e51767. Change-Id: I9b3ec6c101a89f30e61fc683808506c404e5474f Partial-Bug: #1538506
Diffstat (limited to 'troveclient/v1')
-rw-r--r--troveclient/v1/instances.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/troveclient/v1/instances.py b/troveclient/v1/instances.py
index 6a4c40b..a9c5014 100644
--- a/troveclient/v1/instances.py
+++ b/troveclient/v1/instances.py
@@ -15,9 +15,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+import warnings
+
from troveclient import base
from troveclient import common
from troveclient import exceptions
+from troveclient.i18n import _LW
from swiftclient import client as swift_client
@@ -78,10 +81,11 @@ class Instances(base.ManagerWithFind):
return swift_client.Connection(
auth_url, user, key, auth_version="2.0", os_options=os_options)
+ # TODO(mriedem): Remove slave_of after liberty-eol for Trove.
def create(self, name, flavor_id, volume=None, databases=None, users=None,
restorePoint=None, availability_zone=None, datastore=None,
datastore_version=None, nics=None, configuration=None,
- replica_of=None, replica_count=None):
+ replica_of=None, slave_of=None, replica_count=None):
"""Create (boot) a new instance."""
body = {"instance": {
@@ -109,8 +113,14 @@ class Instances(base.ManagerWithFind):
body["instance"]["nics"] = nics
if configuration:
body["instance"]["configuration"] = configuration
- if replica_of:
- body["instance"]["replica_of"] = base.getid(replica_of)
+ if replica_of or slave_of:
+ if slave_of:
+ warnings.warn(_LW("The 'slave_of' argument is deprecated in "
+ "favor of 'replica_of' and will be removed "
+ "after the Trove liberty series is end of "
+ "life."),
+ category=DeprecationWarning)
+ body["instance"]["replica_of"] = base.getid(replica_of) or slave_of
if replica_count:
body["instance"]["replica_count"] = replica_count
@@ -143,6 +153,8 @@ class Instances(base.ManagerWithFind):
if name is not None:
body["instance"]["name"] = name
if detach_replica_source:
+ # NOTE(mriedem): We don't send slave_of since it was removed from
+ # the trove API in mitaka.
body["instance"]["replica_of"] = None
url = "/instances/%s" % base.getid(instance)