git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
695cfb0
)
plimporter: use Site/Slice/Person HRN tags instead of calculating the HRN
author
Mohamed Larabi
<mohamed.larabi@inria.fr>
Wed, 19 Feb 2014 15:26:27 +0000
(16:26 +0100)
committer
Mohamed Larabi
<mohamed.larabi@inria.fr>
Wed, 19 Feb 2014 15:26:27 +0000
(16:26 +0100)
sfa/importer/plimporter.py
patch
|
blob
|
history
diff --git
a/sfa/importer/plimporter.py
b/sfa/importer/plimporter.py
index
3e2a082
..
c320482
100644
(file)
--- a/
sfa/importer/plimporter.py
+++ b/
sfa/importer/plimporter.py
@@
-147,12
+147,12
@@
class PlImporter:
# Get all plc sites
# retrieve only required stuf
sites = shell.GetSites({'peer_id': None, 'enabled' : True},
# Get all plc sites
# retrieve only required stuf
sites = shell.GetSites({'peer_id': None, 'enabled' : True},
- ['site_id','login_base','node_ids','slice_ids','person_ids', 'name'])
+ ['site_id','login_base','node_ids','slice_ids','person_ids', 'name'
, 'hrn'
])
# create a hash of sites by login_base
# sites_by_login_base = dict ( [ ( site['login_base'], site ) for site in sites ] )
# Get all plc users
persons = shell.GetPersons({'peer_id': None, 'enabled': True},
# create a hash of sites by login_base
# sites_by_login_base = dict ( [ ( site['login_base'], site ) for site in sites ] )
# Get all plc users
persons = shell.GetPersons({'peer_id': None, 'enabled': True},
- ['person_id', 'email', 'key_ids', 'site_ids', 'role_ids'])
+ ['person_id', 'email', 'key_ids', 'site_ids', 'role_ids'
, 'hrn'
])
# create a hash of persons by person_id
persons_by_id = dict ( [ ( person['person_id'], person) for person in persons ] )
# also gather non-enabled user accounts so as to issue relevant warnings
# create a hash of persons by person_id
persons_by_id = dict ( [ ( person['person_id'], person) for person in persons ] )
# also gather non-enabled user accounts so as to issue relevant warnings
@@
-185,7
+185,7
@@
class PlImporter:
# create hash by node_id
nodes_by_id = dict ( [ ( node['node_id'], node, ) for node in nodes ] )
# Get all plc slices
# create hash by node_id
nodes_by_id = dict ( [ ( node['node_id'], node, ) for node in nodes ] )
# Get all plc slices
- slices = shell.GetSlices( {'peer_id': None}, ['slice_id', 'name', 'person_ids'])
+ slices = shell.GetSlices( {'peer_id': None}, ['slice_id', 'name', 'person_ids'
, 'hrn'
])
# create hash by slice_id
slices_by_id = dict ( [ (slice['slice_id'], slice ) for slice in slices ] )
# create hash by slice_id
slices_by_id = dict ( [ (slice['slice_id'], slice ) for slice in slices ] )
@@
-205,7
+205,8
@@
class PlImporter:
if site['name'].startswith('sfa:') or site_sfa_created == 'True':
continue
if site['name'].startswith('sfa:') or site_sfa_created == 'True':
continue
- site_hrn = _get_site_hrn(interface_hrn, site)
+ #site_hrn = _get_site_hrn(interface_hrn, site)
+ site_hrn = site['hrn']
# import if hrn is not in list of existing hrns or if the hrn exists
# but its not a site record
site_record=self.locate_by_type_hrn ('authority', site_hrn)
# import if hrn is not in list of existing hrns or if the hrn exists
# but its not a site record
site_record=self.locate_by_type_hrn ('authority', site_hrn)
@@
-281,7
+282,8
@@
class PlImporter:
# make sure to NOT run this if anything is wrong
if not proceed: continue
# make sure to NOT run this if anything is wrong
if not proceed: continue
- person_hrn = email_to_hrn(site_hrn, person['email'])
+ #person_hrn = email_to_hrn(site_hrn, person['email'])
+ person_hrn = person['hrn']
# xxx suspicious again
if len(person_hrn) > 64: person_hrn = person_hrn[:64]
person_urn = hrn_to_urn(person_hrn, 'user')
# xxx suspicious again
if len(person_hrn) > 64: person_hrn = person_hrn[:64]
person_urn = hrn_to_urn(person_hrn, 'user')
@@
-400,7
+402,9
@@
class PlImporter:
slice = slices_by_id[slice_id]
except:
self.logger.warning ("PlImporter: cannot locate slice_id %s - ignored"%slice_id)
slice = slices_by_id[slice_id]
except:
self.logger.warning ("PlImporter: cannot locate slice_id %s - ignored"%slice_id)
- slice_hrn = slicename_to_hrn(interface_hrn, slice['name'])
+ continue
+ #slice_hrn = slicename_to_hrn(interface_hrn, slice['name'])
+ slice_hrn = slice['hrn']
slice_record = self.locate_by_type_hrn ('slice', slice_hrn)
if not slice_record:
try:
slice_record = self.locate_by_type_hrn ('slice', slice_hrn)
if not slice_record:
try: