Commit 64545f6 1 parent 94453a8 commit 64545f6 Copy full SHA for 64545f6
File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 6
6
from dataclasses import dataclass
7
7
import functools
8
8
import logging
9
+ import inspect
9
10
import ssl
10
11
import struct
11
12
import traceback
@@ -911,8 +912,6 @@ class AMSRMQConfiguration:
911
912
"""
912
913
service_port : int
913
914
service_host : str
914
- rabbitmq_erlang_cookie : str
915
- rabbitmq_name : str
916
915
rabbitmq_password : str
917
916
rabbitmq_user : str
918
917
rabbitmq_vhost : str
@@ -936,16 +935,18 @@ def from_json(cls, json_file):
936
935
data = json .load (fd )
937
936
data = {key .replace ("-" , "_" ): value for key , value in data .items ()}
938
937
939
- return cls (** data )
938
+ # Filter out extra fields not accepted by this class
939
+ return cls (** {
940
+ k : v for k , v in data .items ()
941
+ if k in inspect .signature (cls ).parameters
942
+ })
940
943
941
944
def to_dict (self , AMSlib = False ):
942
945
assert AMSlib , "AMSRMQConfiguration cannot convert class to non amslib dictionary"
943
946
if AMSlib :
944
947
return {
945
948
"service-port" : self .service_port ,
946
949
"service-host" : self .service_host ,
947
- "rabbitmq-erlang-cookie" : self .rabbitmq_erlang_cookie ,
948
- "rabbitmq-name" : self .rabbitmq_name ,
949
950
"rabbitmq-password" : self .rabbitmq_password ,
950
951
"rabbitmq-user" : self .rabbitmq_user ,
951
952
"rabbitmq-vhost" : self .rabbitmq_vhost ,
You can’t perform that action at this time.
0 commit comments