cloud: Deprecate jmespath-style filters
jmespath is no longer well maintained [1]. This has always been a bit of a weird feature in the library so let's deprecate it for removal. [1] https://github.com/jmespath/jmespath.py Change-Id: I49c01f8e17ff9cf8a4143401bf9fce7d2d1a72b7 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import ipaddress
|
|||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import uuid
|
import uuid
|
||||||
|
import warnings
|
||||||
|
|
||||||
from decorator import decorator
|
from decorator import decorator
|
||||||
import jmespath
|
import jmespath
|
||||||
@@ -26,6 +27,7 @@ import psutil
|
|||||||
|
|
||||||
from openstack import _log
|
from openstack import _log
|
||||||
from openstack import exceptions
|
from openstack import exceptions
|
||||||
|
from openstack import warnings as os_warnings
|
||||||
|
|
||||||
|
|
||||||
def _dictify_resource(resource):
|
def _dictify_resource(resource):
|
||||||
@@ -100,6 +102,12 @@ def _filter_list(data, name_or_id, filters):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
if isinstance(filters, str):
|
if isinstance(filters, str):
|
||||||
|
warnings.warn(
|
||||||
|
'Support for jmespath-style filters is deprecated and will be '
|
||||||
|
'removed in a future release. Consider using dictionary-style '
|
||||||
|
'filters instead.',
|
||||||
|
os_warnings.RemovedInSDK60Warning,
|
||||||
|
)
|
||||||
return jmespath.search(filters, data)
|
return jmespath.search(filters, data)
|
||||||
|
|
||||||
def _dict_filter(f, d):
|
def _dict_filter(f, d):
|
||||||
|
|||||||
@@ -770,6 +770,11 @@ class Proxy(adapter.Adapter):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if jmespath_filters and isinstance(jmespath_filters, str):
|
if jmespath_filters and isinstance(jmespath_filters, str):
|
||||||
|
warnings.warn(
|
||||||
|
'Support for jmespath-style filters is deprecated and will be '
|
||||||
|
'removed in a future release.',
|
||||||
|
os_warnings.RemovedInSDK60Warning,
|
||||||
|
)
|
||||||
return jmespath.search(jmespath_filters, data)
|
return jmespath.search(jmespath_filters, data)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
Reference in New Issue
Block a user