Ver Fonte

bugfix:修复ListSSLCert方法解析证书列表出错的问题

YuXinLong há 1 ano atrás
pai
commit
79168dd0fc
2 ficheiros alterados com 7 adições e 7 exclusões
  1. 1 1
      proto
  2. 6 6
      src/main.py

+ 1 - 1
proto

@@ -1 +1 @@
-Subproject commit fd50462f6a8a6773c39cb1e6aeee94eeb5392038
+Subproject commit 15ffd7fb7a6ea24e9a8bf1001c1cd0ff4692ecea

+ 6 - 6
src/main.py

@@ -39,10 +39,10 @@ def delivery_to_grpc(delivery):
     )
 
 
-def cert_list_to_grpc(cert):
+def cert_list_to_grpc(results):
     return Cert(
-        certName=cert.get('certName', None),
-        certStatus=cert.get('certStatus', None)
+        certName=results['body']['certName'],
+        certStatus=results['body']['certStatus']
     )
 
 
@@ -363,13 +363,13 @@ class CertDeliveryServiceServicer(llnwCERT_pb2_grpc.CertDeliveryServiceServicer)
         else:
             return check_cert_withdraw_error(res)
 
-    def GetCertList(self, request, context):
-        print("GetCertList")
+    def ListSSLCert(self, request, context):
+        print("ListSSLCert")
         print("请求:", request)
         res = get_cl(request.base).list_customer_certificates(shortname=request.shortname).json()
         print("响应:", res)
         check_error(res, context)
-        return ListSSLCertResponse(certList=CertList([cert_list_to_grpc(results) for results in res['results']]))
+        return ListSSLCertResponse(certList=CertList(cert=[cert_list_to_grpc(results=results) for results in res['results']]))
 
 
 if __name__ == '__main__':