Skip to content

Commit

Permalink
Fix deprecated method call (#256)
Browse files Browse the repository at this point in the history
* Update deprecated call to _get

* More descriptive var name
  • Loading branch information
jeffwecan committed Aug 31, 2018
1 parent c0ceb0d commit 0d32cbc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hvac/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,11 @@ def get_policy(self, name, parse=False):
:rtype:
"""
try:
data = self._get('/v1/sys/policy/{0}'.format(name)).json()
if data.get('rules'):
policy = data.get('rules')
get_policy_response = self._adapter.get('/v1/sys/policy/{0}'.format(name)).json()
if get_policy_response.get('rules'):
policy = get_policy_response.get('rules')
else:
policy = data['data'].get('rules')
policy = get_policy_response['data'].get('rules')
if parse:
if not has_hcl_parser:
raise ImportError('pyhcl is required for policy parsing')
Expand Down

0 comments on commit 0d32cbc

Please sign in to comment.