Skip to content

Commit

Permalink
Remove unversioned version of the API (#863)
Browse files Browse the repository at this point in the history
* Remove unversioned version of the API (fixes #526)
  • Loading branch information
bartv committed Dec 21, 2018
1 parent b55913d commit d0d8856
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Changes in this release:
- Catch various silent test failures
- Initialise variable for upload of version with no resources
- Raise exception on bad export to make inmanta export fail with exit status > 0
- 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

0 comments on commit d0d8856

Please sign in to comment.