@@ -296,7 +296,7 @@ def on_get(req, rep):
296
296
297
297
end = start + (len (res ) - 1 ) if len (res ) > 0 else 0
298
298
rep .set_header ("Accept-Ranges" , "aids" )
299
- rep .set_header ("Content-Range" , f"aids { start } -{ end } /{ count - 1 } " )
299
+ rep .set_header ("Content-Range" , f"aids { start } -{ end } /{ count - 1 } " )
300
300
rep .content_type = "application/json"
301
301
rep .data = json .dumps (res ).encode ("utf-8" )
302
302
@@ -483,17 +483,19 @@ def on_put(self, req, rep, name):
483
483
raise falcon .HTTPNotFound (title = f"No AID with name { name } found" )
484
484
body = req .get_media ()
485
485
newName = body .get ("name" )
486
- habord = hab .db .habs .get (keys = name )
487
- hab .db .habs .put (keys = newName ,
488
- val = habord )
489
- hab .db .habs .rem (keys = name )
486
+ habord = hab .db .habs .get (keys = (hab .pre ,))
487
+ habord .name = newName
488
+ hab .db .habs .pin (keys = (hab .pre ,),
489
+ val = habord )
490
+ hab .db .names .pin (keys = ("" , newName ), val = hab .pre )
491
+ hab .db .names .rem (keys = ("" , name ))
490
492
hab .name = newName
491
493
hab = agent .hby .habByName (newName )
492
494
data = info (hab , agent .mgr , full = True )
493
495
rep .status = falcon .HTTP_200
494
496
rep .content_type = "application/json"
495
497
rep .data = json .dumps (data ).encode ("utf-8" )
496
-
498
+
497
499
def on_delete (self , req , rep , name ):
498
500
""" Identifier delete endpoint
499
501
@@ -509,7 +511,7 @@ def on_delete(self, req, rep, name):
509
511
hab = agent .hby .habByName (name )
510
512
if hab is None :
511
513
raise falcon .HTTPNotFound (title = f"No AID with name { name } found" )
512
- hab . db . habs . rem ( keys = name )
514
+ agent . hby . deleteHab ( name )
513
515
rep .status = falcon .HTTP_200
514
516
515
517
def on_post (self , req , rep , name ):
@@ -532,7 +534,7 @@ def on_post(self, req, rep, name):
532
534
op = self .interact (agent , name , body )
533
535
else :
534
536
raise falcon .HTTPBadRequest (title = "invalid request" ,
535
- description = f"required field 'rot' or 'ixn' missing from request" )
537
+ description = f"required field 'rot' or 'ixn' missing from request" )
536
538
537
539
rep .status = falcon .HTTP_200
538
540
rep .content_type = "application/json"
@@ -709,7 +711,8 @@ def on_get(req, rep, name):
709
711
if role in (kering .Roles .witness ,): # Fetch URL OOBIs for all witnesses
710
712
oobis = []
711
713
for wit in hab .kever .wits :
712
- urls = hab .fetchUrls (eid = wit , scheme = kering .Schemes .http ) or hab .fetchUrls (eid = wit , scheme = kering .Schemes .https )
714
+ urls = hab .fetchUrls (eid = wit , scheme = kering .Schemes .http ) or hab .fetchUrls (eid = wit ,
715
+ scheme = kering .Schemes .https )
713
716
if not urls :
714
717
raise falcon .HTTPNotFound (description = f"unable to query witness { wit } , no http endpoint" )
715
718
@@ -719,7 +722,8 @@ def on_get(req, rep, name):
719
722
res ["oobis" ] = oobis
720
723
elif role in (kering .Roles .controller ,): # Fetch any controller URL OOBIs
721
724
oobis = []
722
- urls = hab .fetchUrls (eid = hab .pre , scheme = kering .Schemes .http ) or hab .fetchUrls (eid = hab .pre , scheme = kering .Schemes .https )
725
+ urls = hab .fetchUrls (eid = hab .pre , scheme = kering .Schemes .http ) or hab .fetchUrls (eid = hab .pre ,
726
+ scheme = kering .Schemes .https )
723
727
if not urls :
724
728
raise falcon .HTTPNotFound (description = f"unable to query controller { hab .pre } , no http endpoint" )
725
729
@@ -728,7 +732,10 @@ def on_get(req, rep, name):
728
732
oobis .append (urljoin (up .geturl (), f"/oobi/{ hab .pre } /controller" ))
729
733
res ["oobis" ] = oobis
730
734
elif role in (kering .Roles .agent ,): # Fetch URL OOBIs for all witnesses
731
- roleUrls = hab .fetchRoleUrls (cid = hab .pre , role = kering .Roles .agent , scheme = kering .Schemes .http ) or hab .fetchRoleUrls (cid = hab .pre , role = kering .Roles .agent , scheme = kering .Schemes .https )
735
+ roleUrls = hab .fetchRoleUrls (cid = hab .pre , role = kering .Roles .agent ,
736
+ scheme = kering .Schemes .http ) or hab .fetchRoleUrls (cid = hab .pre ,
737
+ role = kering .Roles .agent ,
738
+ scheme = kering .Schemes .https )
732
739
if kering .Roles .agent not in roleUrls :
733
740
res ['oobis' ] = []
734
741
else :
0 commit comments