Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unversioned version of the API #863

Merged
merged 4 commits into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changes in this release:
- Introduce request_timeout option for transport settings
- Port unit tests to pytest-asyncio and fix deprecation warnings (#743)
- Remove all io_loop references and only use current ioloop (#847)
- Removed the non-version api (#526)

v 2018.3 (2018-12-07)
Changes in this release:
Expand Down
14 changes: 2 additions & 12 deletions src/inmanta/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from datetime import datetime
from collections import defaultdict
import enum
import warnings
import io
import gzip

Expand Down Expand Up @@ -279,11 +278,11 @@ def callback(self, fnc):
# Shared
class RESTBase(object):

def _create_base_url(self, properties, msg=None, versioned=True):
def _create_base_url(self, properties, msg=None):
"""
Create a url for the given protocol properties
"""
url = "/api/v1" if versioned else ""
url = "/api/v1"
if "id" in properties and properties["id"]:
if msg is None:
url += "/%s/(?P<id>[^/]+)" % properties["method_name"]
Expand All @@ -310,10 +309,6 @@ def _decode(self, body):

@gen.coroutine
def _execute_call(self, kwargs, http_method, config, message, request_headers, auth=None):
if "api_version" in config[0] and config[0]["api_version"] is None:
warnings.warn("Using an unversioned API method will be removed in the next release", DeprecationWarning)
LOGGER.warning("Using an unversioned API method will be removed in the next release")

headers = {"Content-Type": "application/json"}
try:
if kwargs is None or config is None:
Expand Down Expand Up @@ -543,11 +538,6 @@ def create_op_mapping(self):
properties["api_version"] = "1"
url_map[url][properties["operation"]] = (properties, call, method.__wrapped__)

url = self._create_base_url(properties, versioned=False)
properties = properties.copy()
properties["api_version"] = None
url_map[url][properties["operation"]] = (properties, call, method.__wrapped__)

headers.add("Authorization")
self.headers = headers
return url_map
Expand Down
4 changes: 0 additions & 4 deletions src/inmanta/server/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ def create_op_mapping(self):
url = self._create_base_url(properties)
properties["api_version"] = "1"
url_map[url][properties["operation"]] = (properties, call, method.__wrapped__)
url = self._create_base_url(properties, versioned=False)
properties = properties.copy()
properties["api_version"] = None
url_map[url][properties["operation"]] = (properties, call, method.__wrapped__)
return url_map

def start(self):
Expand Down