From: Tony Mack Date: Fri, 29 Jun 2012 17:59:13 +0000 (-0400) Subject: added 'auth' param to __init__ X-Git-Tag: sfa-2.1-12~29 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=1d0ab72103c2198f46640464da4338a7dd6f6475;p=sfa.git added 'auth' param to __init__ --- diff --git a/sfa/openstack/osxrn.py b/sfa/openstack/osxrn.py index ad82f22c..830ee9ac 100644 --- a/sfa/openstack/osxrn.py +++ b/sfa/openstack/osxrn.py @@ -3,16 +3,22 @@ from sfa.util.xrn import Xrn from sfa.util.config import Config def hrn_to_os_slicename(hrn): - return OSXrn(xrn=hrn, type='slice').get_slicename() + return OSXrn(xrn=hrn, type='slice').get_slicename() + +def cleanup_name(name): + return name.replace(".", "_").replace("+", "_") class OSXrn(Xrn): - def __init__(self, name=None, type=None, **kwds): + def __init__(self, name=None, type=None, auth=None, **kwds): config = Config() if name is not None: self.type = type - self.hrn = config.SFA_INTERFACE_HRN + "." + name + if auth is not None: + self.hrn='.'.join([auth, cleanup_name(name)]) + else: + self.hrn = config.SFA_INTERFACE_HRN + "." + cleanup_name(name) self.hrn_to_urn() else: Xrn.__init__(self, **kwds)