Skip to content

Commit

Permalink
Add deprecation warning for searching for hosts via Infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
samanthadrago committed Apr 18, 2018
1 parent 0b9bfba commit f4643c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion datadog/api/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def search(cls, **params):
"""
return super(Hosts, cls)._search(**params)


@classmethod
def totals(cls):
"""
Expand Down
5 changes: 5 additions & 0 deletions datadog/api/infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ def search(cls, **params):
:returns: Dictionary representing the API's JSON response
"""
# Deprecate the hosts search param
query = params.get('q', '').split(':')
if len(query) > 1 and query[0] == 'hosts':
print("[DEPRECATION] Infrastructure.search() is deprecated for ",
"hosts. Use `Hosts.search` instead.")
return super(Infrastructure, cls)._search(**params)

0 comments on commit f4643c0

Please sign in to comment.