Create header with authtoken for requests without args
This patch adds authentication tokens to headers for requests that do not include arguments like DELETE and GET. Closes-bug: #1680575 Change-Id: Ifc1c1e701f45eed28afc101a32e2232b3f3c3546
This commit is contained in:
parent
2c2efb123f
commit
9928b3a6db
|
@ -127,13 +127,14 @@ class OctaviaRequest(object):
|
|||
|
||||
def request(self, method, url, args=None, headers=None):
|
||||
if args:
|
||||
if not headers:
|
||||
token = self.auth_session.get_token()
|
||||
headers = {
|
||||
'Content-type': 'application/json',
|
||||
'X-Auth-Token': token
|
||||
}
|
||||
args = jsonutils.dumps(args)
|
||||
|
||||
if not headers or not headers.get('X-Auth-Token'):
|
||||
headers = headers or {
|
||||
'Content-type': 'application/json',
|
||||
}
|
||||
headers['X-Auth-Token'] = self.auth_session.get_token()
|
||||
|
||||
LOG.debug("url = %s", '%s%s' % (self.base_url, str(url)))
|
||||
LOG.debug("args = %s", args)
|
||||
r = requests.request(method,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Authentication tokens are now added to GET and DELETE Octavia requests if
|
||||
missing.
|
Loading…
Reference in New Issue