Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignore_unknown_fields to json_format.Parse() calls #703

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions control/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def gateway_rpc_caller(self, requests, is_add_req):
for key, val in requests.items():
if key.startswith(GatewayState.SUBSYSTEM_PREFIX):
if is_add_req:
req = json_format.Parse(val, pb2.create_subsystem_req())
req = json_format.Parse(val, pb2.create_subsystem_req(), ignore_unknown_fields=True)
self.gateway_rpc.create_subsystem(req)
else:
req = json_format.Parse(val,
Expand All @@ -538,7 +538,7 @@ def gateway_rpc_caller(self, requests, is_add_req):
self.gateway_rpc.delete_subsystem(req)
elif key.startswith(GatewayState.NAMESPACE_PREFIX):
if is_add_req:
req = json_format.Parse(val, pb2.namespace_add_req())
req = json_format.Parse(val, pb2.namespace_add_req(), ignore_unknown_fields=True)
self.gateway_rpc.namespace_add(req)
else:
req = json_format.Parse(val,
Expand All @@ -547,21 +547,21 @@ def gateway_rpc_caller(self, requests, is_add_req):
self.gateway_rpc.namespace_delete(req)
elif key.startswith(GatewayState.NAMESPACE_QOS_PREFIX):
if is_add_req:
req = json_format.Parse(val, pb2.namespace_set_qos_req())
req = json_format.Parse(val, pb2.namespace_set_qos_req(), ignore_unknown_fields=True)
self.gateway_rpc.namespace_set_qos_limits(req)
else:
# Do nothing, this is covered by the delete namespace code
pass
elif key.startswith(GatewayState.HOST_PREFIX):
if is_add_req:
req = json_format.Parse(val, pb2.add_host_req())
req = json_format.Parse(val, pb2.add_host_req(), ignore_unknown_fields=True)
self.gateway_rpc.add_host(req)
else:
req = json_format.Parse(val, pb2.remove_host_req(), ignore_unknown_fields=True)
self.gateway_rpc.remove_host(req)
elif key.startswith(GatewayState.LISTENER_PREFIX):
if is_add_req:
req = json_format.Parse(val, pb2.create_listener_req())
req = json_format.Parse(val, pb2.create_listener_req(), ignore_unknown_fields=True)
self.gateway_rpc.create_listener(req)
else:
req = json_format.Parse(val, pb2.delete_listener_req(), ignore_unknown_fields=True)
Expand Down
Loading