mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Have cookie JAR's respect the configured cachedir
And only when missing default to `syspaths.CACHE_DIR`
This commit is contained in:
parent
7914f51636
commit
c312592c81
1 changed files with 7 additions and 4 deletions
|
@ -68,8 +68,6 @@ except ImportError:
|
|||
HAS_CERTIFI = False
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
JARFILE = os.path.join(syspaths.CACHE_DIR, 'cookies.txt')
|
||||
SESSIONJARFILE = os.path.join(syspaths.CACHE_DIR, 'cookies.session.p')
|
||||
USERAGENT = 'Salt/{0}'.format(salt.version.__version__)
|
||||
|
||||
|
||||
|
@ -90,10 +88,10 @@ def query(url,
|
|||
headers=False,
|
||||
text=False,
|
||||
cookies=None,
|
||||
cookie_jar=JARFILE,
|
||||
cookie_jar=None,
|
||||
cookie_format='lwp',
|
||||
persist_session=False,
|
||||
session_cookie_jar=SESSIONJARFILE,
|
||||
session_cookie_jar=None,
|
||||
data_render=False,
|
||||
data_renderer=None,
|
||||
header_render=False,
|
||||
|
@ -178,6 +176,11 @@ def query(url,
|
|||
if header_list is None:
|
||||
header_list = []
|
||||
|
||||
if cookie_jar is None:
|
||||
cookie_jar = os.path.join(opts.get('cachedir', syspaths.CACHE_DIR), 'cookies.txt')
|
||||
if session_cookie_jar is None:
|
||||
cookie_jar = os.path.join(opts.get('cachedir', syspaths.CACHE_DIR), 'cookies.session.p')
|
||||
|
||||
if persist_session is True and HAS_MSGPACK:
|
||||
# TODO: This is hackish; it will overwrite the session cookie jar with
|
||||
# all cookies from this one connection, rather than behaving like a
|
||||
|
|
Loading…
Add table
Reference in a new issue