@@ -880,11 +880,10 @@ class CertificateHandler:
880
880
file_loc = '/tmp'
881
881
file_suffix = '.pem'
882
882
file_prefix = 'cert_'
883
- CERT_BUSNAME = 'xyz.openbmc_project.Certs.Manager'
884
883
CERT_PATH = '/xyz/openbmc_project/certs'
885
884
CERT_IFACE = 'xyz.openbmc_project.Certs.Install'
886
885
887
- def do_upload (cls , cert_type , service ):
886
+ def do_upload (cls , route_handler , cert_type , service ):
888
887
def cleanup ():
889
888
if os .path .exists (temp .name ):
890
889
os .remove (temp .name )
@@ -911,16 +910,20 @@ def cleanup():
911
910
912
911
try :
913
912
bus = dbus .SystemBus ()
914
- busName = cls .CERT_BUSNAME + "." + cert_type .capitalize () + "." \
915
- + service .capitalize ()
916
913
certPath = cls .CERT_PATH + "/" + cert_type + "/" + service
917
- obj = bus .get_object (busName , certPath )
918
- iface = dbus .Interface (obj , cls .CERT_IFACE )
919
- iface .Install (temp .name )
920
- except dbus .exceptions .DBusException as e :
914
+ intfs = route_handler .try_mapper_call (
915
+ route_handler .mapper .get_object , path = certPath )
916
+ for busname ,intf in intfs .items ():
917
+ if cls .CERT_IFACE in intf :
918
+ obj = bus .get_object (busName , certPath )
919
+ iface = dbus .Interface (obj , cls .CERT_IFACE )
920
+ iface .Install (temp .name )
921
+ cleanup ()
922
+ return
923
+ abort (404 , "Path not found" )
924
+ except Exception as e :
921
925
cleanup ()
922
926
abort (503 , str (e ))
923
- cleanup ()
924
927
925
928
926
929
class CertificatePutHandler (RouteHandler ):
@@ -935,7 +938,7 @@ def __init__(self, app, bus):
935
938
app , bus , self .verbs , self .rules , self .content_type )
936
939
937
940
def do_put (self , cert_type , service ):
938
- return CertificateHandler ().do_upload (cert_type , service )
941
+ return CertificateHandler ().do_upload (self , cert_type , service )
939
942
940
943
def find (self , ** kw ):
941
944
pass
0 commit comments