Commit 1a1a75a7 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Remove the code that deletes the slice at the SA; no longer allowed to

do that, so do not try.

Also set the expiration time when registering (to six hours). Mostly
for demonstration purposes.
parent 23dfea4e
...@@ -19,13 +19,15 @@ ...@@ -19,13 +19,15 @@
import sys import sys
import pwd import pwd
import getopt import getopt
import time
import os import os
import re import re
import xmlrpclib import xmlrpclib
from M2Crypto import X509 from M2Crypto import X509
ACCEPTSLICENAME=1 ACCEPTSLICENAME=1
OtherUser = None OtherUser = None
Expiration = (60 * 60 * 6)
execfile( "test-common.py" ) execfile( "test-common.py" )
...@@ -40,7 +42,7 @@ mycredential = get_self_credential() ...@@ -40,7 +42,7 @@ mycredential = get_self_credential()
print "Got my SA credential" print "Got my SA credential"
# #
# Lookup slice, delete before proceeding. # Lookup slice.
# #
params = {} params = {}
params["credential"] = mycredential params["credential"] = mycredential
...@@ -48,17 +50,16 @@ params["type"] = "Slice" ...@@ -48,17 +50,16 @@ params["type"] = "Slice"
params["hrn"] = SLICENAME params["hrn"] = SLICENAME
rval,response = do_method("sa", "Resolve", params) rval,response = do_method("sa", "Resolve", params)
if rval == 0: if rval == 0:
print "Deleting previously registered slice"; print "Slice already exists."
params = {} sys.exit(0)
params["credential"] = mycredential
params["type"] = "Slice"
params["hrn"] = SLICENAME
rval,response = do_method("sa", "Remove", params)
if rval:
Fatal("Could not remove slice record")
pass
pass pass
#
# Set up expiration.
#
valid_until = time.strftime("%Y%m%dT%H:%M:%S",
time.gmtime(time.time() + Expiration))
# #
# Create a slice. # Create a slice.
# #
...@@ -67,6 +68,7 @@ params = {} ...@@ -67,6 +68,7 @@ params = {}
params["credential"] = mycredential params["credential"] = mycredential
params["type"] = "Slice" params["type"] = "Slice"
params["hrn"] = SLICENAME params["hrn"] = SLICENAME
params["expiration"] = valid_until
rval,response = do_method("sa", "Register", params) rval,response = do_method("sa", "Register", params)
if rval: if rval:
Fatal("Could not get my slice") Fatal("Could not get my slice")
......
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