Closed fuqianggao closed 3 years ago
cc @Rainton
@fuqianggao Does this error occur when the -node_id
field contains backslash in request.yaml? May I see your input yaml file?
node_matchers:
node_matchers:
- node_id: exact: "sidecar-10.4.0.2-productpage-v1-787d794cf9-rztcj.default-\default.svc.cluster.local" node_metadatas:
- path:
- key: TRAFFICDIRECTOR_GCP_PROJECT_NUMBER value: string_match: exact: "798832730858"
- path:
- key: TRAFFICDIRECTOR_NETWORK_NAME value: string_match: exact: "default"
@fuqianggao I think maybe you should use \\
instead of \
?
eg:
node_matchers:
- node_id:
exact: "sidecar-10.4.0.2-productpage-v1-787d794cf9-rztcj.default-\\default.svc.cluster.local"
node_metadatas:
- path:
- key: TRAFFICDIRECTOR_GCP_PROJECT_NUMBER
value:
string_match:
exact: "798832730858"
- path:
- key: TRAFFICDIRECTOR_NETWORK_NAME
value:
string_match:
exact: "default"
Then the client will work well and we can get the JSON output as following:
{
"nodeId": {
"exact": "sidecar-10.4.0.2-productpage-v1-787d794cf9-rztcj.default-\\default.svc.cluster.local"
},
"nodeMetadatas": [
{
"path": [
{
"key": "TRAFFICDIRECTOR_GCP_PROJECT_NUMBER"
}
],
"value": {
"stringMatch": {
"exact": "798832730858"
}
}
},
{
"path": [
{
"key": "TRAFFICDIRECTOR_NETWORK_NAME"
}
],
"value": {
"stringMatch": {
"exact": "default"
}
}
}
]
}
Since in JSON and YAML, backslash in the string is considered as a special character and the correct representation of the backslash inside strings is \\
.
If the node id contains a backslash, the config in JSON in response should be like ".....\\...."
, or the JSON format is wrong.
You are right. Thanks.
csds-client will throw an error: "found unknown escape character" if node id contains backslash