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

convert all underscore fields to camel case #266

Open
RavinderReddyF5 opened this issue Aug 14, 2020 · 2 comments
Open

convert all underscore fields to camel case #266

RavinderReddyF5 opened this issue Aug 14, 2020 · 2 comments
Labels

Comments

@RavinderReddyF5
Copy link
Owner

Issue by the-player777
Wednesday Jan 15, 2020 at 12:46 GMT
Originally opened as https://github.com/terraform-providers/terraform-provider-bigip/pull/235


Fixing issue #119


the-player777 included the following code: https://github.com/terraform-providers/terraform-provider-bigip/pull/235/commits

@RavinderReddyF5
Copy link
Owner Author

Comment by papineni87
Wednesday Jan 29, 2020 at 10:44 GMT


Looks like acceptance test is failing for this change

BIGIP_USER=admin BIGIP_PASSWORD=xxxxx BIGIP_HOST=10.145.69.41 TF_ACC=1 go test ./bigip -v -run=TestAccBigipLtmPolicy_create
--- FAIL: TestAccBigipLtmPolicy_create (0.87s)
testing.go:569: Step 0 error: errors during apply:

    Error: 010716de:3: Policy '/Common/Drafts/test-policy', rule 'rule6'; target 'forward' action 'select' does not support parameter of type 'name'.
    
      on /tmp/tf-test888880187/main.tf line 23:
      (source code not available)
    
    
    
    Error: 010716de:3: Policy '/Common/Drafts/http_to_https_redirect', rule 'http_to_https_redirect_rule'; target 'http-reply' action 'redirect' does not support parameter of type 'name'.
    
      on /tmp/tf-test888880187/main.tf line 39:
      (source code not available)

May be we should not convert all parameters to camel case, we should convert only specific parameters as defined in policy structure.

Can you check it once.

@RavinderReddyF5
Copy link
Owner Author

Comment by thorhs
Monday Mar 16, 2020 at 13:40 GMT


For me, leaving out tm_name = "20" in the test policies, in bigip/resource_bigip_ltm_policy_test.go makes this work. Looking at the JSON that is being sent over to the F5 box, it seems that tm_name is being ignored in the master branch, but being converted to tmName in this new version.

What I suppose is happening is that there is no Tm_name in the F5 data structure, so it is being silently ignored. Below is an example of the failing JSON, when run using this PR:

{
    "controls": [
        "forwarding"
    ],
    "name": "Drafts/http_to_https_redirect",
    "publishedCopy": "",
    "requires": [
        "http"
    ],
    "rulesReference": {
        "items": [
            {
                "actionsReference": {
                    "items": [
                        {
                            "httpReply": true,
                            "location": "tcl:https://[HTTP::host][HTTP::uri]",
                            "name": "0",
                            "redirect": true,
                            "tmName": "20"
                        }
                    ]
                },
                "conditionsReference": {},
                "name": "http_to_https_redirect_rule",
                "ordinal": 0
            }
        ]
    },
    "strategy": "/Common/first-match"
}

And here is the JSON from the master branch version of the code:

{
    "controls": [
        "forwarding"
    ],
    "name": "Drafts/http_to_https_redirect",
    "publishedCopy": "",
    "requires": [
        "http"
    ],
    "rulesReference": {
        "items": [
            {
                "actionsReference": {
                    "items": [
                        {
                            "httpReply": true,
                            "location": "tcl:https://[HTTP::host][HTTP::uri]",
                            "name": "0",
                            "redirect": true
                        }
                    ]
                },
                "conditionsReference": {},
                "name": "http_to_https_redirect_rule",
                "ordinal": 0
            }
        ]
    },
    "strategy": "/Common/first-match"
}

As you can see, there is no tm_name being sent over the wire when using the master branch.

Removing the tm_name from the test case makes the tests run successfully again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant