upd
This commit is contained in:
parent
7e540c54e9
commit
b43c082424
|
@ -6,7 +6,7 @@ from ng_openstack import exceptions
|
|||
|
||||
class Openstack_Request:
|
||||
def make_request(_self, getPost, url, data, apiEndpoint, scopedProjectID=""):
|
||||
|
||||
print("Making a request {} {} ".format(apiEndpoint,url))
|
||||
# Default the scope project to the value set in .env.example, allow the user to override if required(EG creating backups)
|
||||
if scopedProjectID== "":
|
||||
scopedProjectID=os.getenv("OS_PROJECT_ID")
|
||||
|
@ -86,12 +86,12 @@ class Openstack_Request:
|
|||
timeout=4)
|
||||
|
||||
if response.status_code == 201:
|
||||
_self.saveTokenToRedis(username, authDomain, scopeDomain, scopeProject, response.headers['X-Subject-Token'])
|
||||
_self.saveTokenToRedis( username, authDomain, scopeDomain, scopeProject, response.headers['X-Subject-Token'])
|
||||
return response.headers['X-Subject-Token']
|
||||
else:
|
||||
raise ValueError("Error in token response to token request:"+response.text)
|
||||
|
||||
def lookupTokenFromRedis(_self,username, authDomain, scopeDomain, scopeProject):
|
||||
def lookupTokenFromRedis(_self, username, authDomain, scopeDomain, scopeProject):
|
||||
|
||||
REDIS=redis.Redis()
|
||||
|
||||
|
@ -110,7 +110,7 @@ class Openstack_Request:
|
|||
except:
|
||||
raise exceptions.ItemNotFoundError("OpenstackToken not found in redis")
|
||||
|
||||
def saveTokenToRedis(username, authDomain, scopeDomain, scopeProject,token):
|
||||
def saveTokenToRedis(_self, username, authDomain, scopeDomain, scopeProject,token):
|
||||
|
||||
REDIS=redis.Redis()
|
||||
|
||||
|
|
Loading…
Reference in New Issue