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:
d88b95d
)
reset gids passing urn to get the correct type
author
Loic Baron
<loic.baron@lip6.fr>
Thu, 16 Feb 2017 05:26:55 +0000
(06:26 +0100)
committer
Loic Baron
<loic.baron@lip6.fr>
Thu, 16 Feb 2017 05:26:55 +0000
(06:26 +0100)
sfa/client/sfaresetgids.py
patch
|
blob
|
history
diff --git
a/sfa/client/sfaresetgids.py
b/sfa/client/sfaresetgids.py
index
d7def28
..
d4d46f6
100644
(file)
--- a/
sfa/client/sfaresetgids.py
+++ b/
sfa/client/sfaresetgids.py
@@
-9,6
+9,7
@@
from sfa.storage.alchemy import alchemy
from sfa.storage.model import RegRecord
from sfa.trust.hierarchy import Hierarchy
from sfa.trust.certificate import convert_public_key, Keypair
from sfa.storage.model import RegRecord
from sfa.trust.hierarchy import Hierarchy
from sfa.trust.certificate import convert_public_key, Keypair
+from sfa.util.xrn import hrn_to_urn
"""
WARNING : This script is not exactly thoroughly tested
"""
WARNING : This script is not exactly thoroughly tested
@@
-101,12
+102,13
@@
class SfaResetGids:
########## user : rebuild a gid from pubkey and email
if record.type == 'user':
hrn = str(record.hrn)
########## user : rebuild a gid from pubkey and email
if record.type == 'user':
hrn = str(record.hrn)
+ urn = hrn_to_urn(hrn, str(record.type))
gid = record.get_gid_object()
uuid = gid.get_uuid()
pub = gid.get_pubkey()
email = gid.get_email()
print("pub {} uuid {}... email {}".format(pub, str(uuid)[:6], email))
gid = record.get_gid_object()
uuid = gid.get_uuid()
pub = gid.get_pubkey()
email = gid.get_email()
print("pub {} uuid {}... email {}".format(pub, str(uuid)[:6], email))
- new_gid = hierarchy.create_gid(
h
rn, uuid, pub, email=email)
+ new_gid = hierarchy.create_gid(
u
rn, uuid, pub, email=email)
new_gid_str = new_gid.save_to_string()
record.gid = new_gid_str
print("NEW {} {} [{}]".format(record.type, record.hrn, email))
new_gid_str = new_gid.save_to_string()
record.gid = new_gid_str
print("NEW {} {} [{}]".format(record.type, record.hrn, email))
@@
-129,11
+131,12
@@
class SfaResetGids:
########## slices
if record.type == 'slice':
hrn = str(record.hrn)
########## slices
if record.type == 'slice':
hrn = str(record.hrn)
+ urn = hrn_to_urn(hrn, str(record.type))
gid = record.get_gid_object()
uuid = gid.get_uuid()
pub = gid.get_pubkey()
print("pub {} uuid {}...".format(pub, str(uuid)[:6]))
gid = record.get_gid_object()
uuid = gid.get_uuid()
pub = gid.get_pubkey()
print("pub {} uuid {}...".format(pub, str(uuid)[:6]))
- new_gid = hierarchy.create_gid(
h
rn, uuid, pub)
+ new_gid = hierarchy.create_gid(
u
rn, uuid, pub)
new_gid_str = new_gid.save_to_string()
record.gid = new_gid_str
print("NEW {} {}".format(record.type, record.hrn))
new_gid_str = new_gid.save_to_string()
record.gid = new_gid_str
print("NEW {} {}".format(record.type, record.hrn))
@@
-158,5
+161,4
@@
class SfaResetGids:
if __name__ == '__main__':
session = alchemy.session()
tophrn = Config().SFA_REGISTRY_ROOT_AUTH
if __name__ == '__main__':
session = alchemy.session()
tophrn = Config().SFA_REGISTRY_ROOT_AUTH
- print(tophrn)
SfaResetGids(session, tophrn).main()
SfaResetGids(session, tophrn).main()