f5-appsvcs-extension icon indicating copy to clipboard operation
f5-appsvcs-extension copied to clipboard

responseTemplate trouble with curly braces

Open wncocz opened this issue 3 years ago • 2 comments

Environment

  • Application Services Version: 3.28.0
  • BIG-IP Version: 14.1.4.1

Summary

Curly braces in responseTemplate in Traffic_Log_Profile sometimes disappear or cause errors.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Submit the following declaration:
{
    "action": "deploy",
    "persist": true,
    "class": "AS3",
    "declaration": {
        "class": "ADC",
        "id": "blah-0001",
        "schemaVersion": "3.28.0",
        "t1": {
            "class": "Tenant",
            "t1a1": {
                "class": "Application",
                "template": "generic",
                "rsp_log": {
                    "class": "Traffic_Log_Profile",
                    "responseSettings": {
                        "responseEnabled": true,
                        "responseTemplate": "foo: {{bar} :{baz} : {again}"
                    }
                }
            }
        }
    }
}
  1. Observe the following error response:
{
    - code: 400
      host: localhost
      message: declaration failed
      response: POST http://admin:XXXXXX@localhost:8100/mgmt/tm/sys/config merge cli script response=400 body={"code":400,"message":"incomplete command","errorStack":[],"apiError":26214401}
      runTime: 4688
      tenant: t1
}

Expected Behavior

ltm profile request-log rsp_log {
    response-log-template "foo: {{bar} :{baz} : {again}"
    response-logging enabled
}

OK, that one had an obvious issue with the double-left-curly-brace. But the error is worth noting.

This case more resembles what we need to deploy:

  1. Submit the following declaration:
{
    "action": "deploy",
    "persist": true,
    "class": "AS3",
    "declaration": {
        "class": "ADC",
        "id": "blah-0001",
        "schemaVersion": "3.28.0",
        "t1": {
            "class": "Tenant",
            "t1a1": {
                "class": "Application",
                "template": "generic",
                "rsp_log": {
                    "class": "Traffic_Log_Profile",
                    "responseSettings": {
                        "responseEnabled": true,
                        "responseTemplate": "foo: {bar} :{baz} : {again}"
                    }
                }
            }
        }
    }
}
  1. Observe the following error response:
{
    - code: 200
      host: localhost
      lineCount: 18
      message: success
      runTime: 6607
      tenant: t1
}

Expected Behavior

ltm profile request-log rsp_log {
    response-log-template "foo: {bar} :{baz} : {again}"
    response-logging enabled
}

Actual Behavior

The double-curly-brace gives the 400 error above.

The second declaration yields this (irrelevant properties excluded):

ltm profile request-log rsp_log {
    response-log-template "foo: bar :{baz} : again "
    response-logging enabled
}

The template is missing some curly braces.

wncocz avatar Jun 19 '21 09:06 wncocz

Thank you for your feedback. I have added AUTOTOOL-2589 to our internal product backlog to address the disappearing curly bracket issue.

The issue of the unbalanced curly brackets is more difficult because of how the iRule is embedded into a tcl script to apply the changes. We have previously looked into validating iRules to avoid those kinds of errors, but determined it was out of scope.

dstokesf5 avatar Aug 31 '21 19:08 dstokesf5

Thank you. I'm less concerned about the unbalanced ones - that was just a finding in my experiments. The 2nd case (step 3 above, with multiple, balanced, curly braces) is the one that actually breaks our configurations.

wncocz avatar Aug 31 '21 21:08 wncocz