mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
StormPath state: take backend as param for httperrors, deprecate requests_lib:True
This commit is contained in:
parent
5523417b52
commit
217523653f
@ -9,6 +9,9 @@ Support for Stormpath.
|
||||
from __future__ import absolute_import
|
||||
import pprint
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
@ -54,10 +57,18 @@ def present(name, **kwargs):
|
||||
Optional. Must be specified as a dict.
|
||||
'''
|
||||
# Because __opts__ is not available outside of functions
|
||||
if __opts__.get('requests_lib', False):
|
||||
backend = __opts__.get('backend', False)
|
||||
if not backend and __opts__.get('requests_lib', False):
|
||||
salt.utils.warn_until('Oxygen', '"requests_lib:True" has been replaced by "backend:requests", '
|
||||
'please change your config')
|
||||
backend = 'requests'
|
||||
|
||||
if backend == 'requests':
|
||||
from requests.exceptions import HTTPError
|
||||
else:
|
||||
elif backend == 'urrlib2':
|
||||
from urllib2 import HTTPError
|
||||
else:
|
||||
from tornado.httpclient import HTTPError
|
||||
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
@ -136,10 +147,18 @@ def absent(name, directory_id=None):
|
||||
performance of this state.
|
||||
'''
|
||||
# Because __opts__ is not available outside of functions
|
||||
if __opts__.get('requests_lib', False):
|
||||
backend = __opts__.get('backend', False)
|
||||
if not backend and __opts__.get('requests_lib', False):
|
||||
salt.utils.warn_until('Oxygen', '"requests_lib:True" has been replaced by "backend:requests", '
|
||||
'please change your config')
|
||||
backend = 'requests'
|
||||
|
||||
if backend == 'requests':
|
||||
from requests.exceptions import HTTPError
|
||||
else:
|
||||
elif backend == 'urrlib2':
|
||||
from urllib2 import HTTPError
|
||||
else:
|
||||
from tornado.httpclient import HTTPError
|
||||
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
|
Loading…
Reference in New Issue
Block a user