All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 1352fafa authored by David Johnson's avatar David Johnson

Ok, use project URLs for SA::Register and SA::Renew.

parent 0a1f2ab5
Pipeline #2010 passed with stages
in 22 seconds
......@@ -1007,7 +1007,7 @@ class ProtoGeniServer(object):
"""
return ProtoGeniServer.CacheNotifier(self)
def do_method(self,module,method,params,URI=None,quiet=False,version=None,
def do_method(self,module,method,params,URI=None,project=None,quiet=False,version=None,
response_handler=None,cm=None,
force=False,cache=False,cache_accept_stale=False,
cache_add_params=[],cache_destroy_params=[],
......@@ -1020,6 +1020,7 @@ class ProtoGeniServer(object):
:param method: The RPC method to invoke.
:param params: A dict of params to pass to the method invocation.
:param URI: A custom URI to use; if not supplied, the full URI is constructed based on the specified @module and @cm.
:param project: If this is a Project URN (i.e. for ProtoGENI/Cloudlab), this is the project we need to stick into URLs for some SA calls (i.e. Register, RenewSlice).
:param version: Specify the version of the module/method being invoked (i.e., a str like "2.0"
:param cm: Call this method on a specific CM; defaults to self.default_cm.
:param force: If True, don't simply return a cached value even if a valid, unexpired value exists in the cache; call the method on the server. Otherwise, if a non-zero, positive integer, if the value is cached and the result is older than `force` seconds, also call the method on the server.
......@@ -1100,6 +1101,10 @@ class ProtoGeniServer(object):
"/protogeni/" + self.devuser + "/")
url = url._replace(path=upath)
if project is not None and url.path.endswith("/sa"):
upath = url.path.replace("/sa","/project/%s/sa" % (str(project),))
url = url._replace(path=upath)
LOG.debug("URL: %s || %s" % (str(url),method))
#
......@@ -1374,7 +1379,7 @@ class ProtoGeniServer(object):
return (rval, response)
def do_method_retry(self,module,method,params,URI=None,retries=200,
def do_method_retry(self,module,method,params,URI=None,project=None,retries=200,
quiet=False,version=None,response_handler=None,cm=None,
force=False,cache=False,cache_accept_stale=False,
cache_add_params=[],cache_destroy_params=[],
......@@ -1385,7 +1390,7 @@ class ProtoGeniServer(object):
"""
count = retries
rval, response = \
self.do_method(module,method,params,URI=URI,quiet=quiet,cm=cm,
self.do_method(module,method,params,URI=URI,project=project,quiet=quiet,cm=cm,
version=version,response_handler=response_handler,
force=force,cache=cache,
cache_accept_stale=cache_accept_stale,
......@@ -1400,7 +1405,7 @@ class ProtoGeniServer(object):
LOG.debug("Will try again in a few seconds (%s)" % (str(response),))
time.sleep(5.0)
rval, response = \
self.do_method(module,method,params,URI=URI,quiet=quiet,cm=cm,
self.do_method(module,method,params,URI=URI,project=project,quiet=quiet,cm=cm,
version=version,response_handler=response_handler,
force=force,cache=cache,
cache_accept_stale=cache_accept_stale,
......@@ -1795,14 +1800,20 @@ class ProtoGeniServer(object):
params = {}
params["credential"] = selfcredential
params["type"] = "Slice"
project = None
if slicename.startswith("urn:"):
params["urn"] = slicename
uchunks = slicename.split('+')
if len(uchunks) == 4:
hnchunks = uchunks[1].split(":")
if len(hnchunks) >= 2:
project = hnchunks[1]
else:
params["hrn"] = slicename
pass
params["expiration"] = valid_until
rval,response = self.do_method("sa", "Register", params)
rval,response = self.do_method("sa", "Register", params, project=project)
if rval:
self.__put_lock()
raise exc.RPCError("sa::Register",rval,response,
......@@ -1901,8 +1912,14 @@ class ProtoGeniServer(object):
selfcredential=selfcredential)
slice_id = None
project = None
if 'urn' in myslice:
slice_id = myslice['urn']
uchunks = slice_id.split('+')
if len(uchunks) == 4:
hnchunks = uchunks[2].split(":")
if len(hnchunks) >= 2:
project = hnchunks[1]
else:
slice_id = myslice['uuid']
......@@ -1917,7 +1934,7 @@ class ProtoGeniServer(object):
# from GetCredential, so replace it in the cache too.
#
rval,response = \
self.do_method_retry("sa","RenewSlice",params,
self.do_method_retry("sa","RenewSlice",params,project=project,
cache=False,cache_replace_info=crd,
cache_expire_func=self.__get_cred_expire_local_timestamp)
if rval:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment