Forum Discussion

JustJozef's avatar
JustJozef
Icon for Cirrus rankCirrus
Jun 29, 2022
Solved

icontrol - import policy create new policy instead overwriting of old one

Hello,

 

I trying to import and update of policy via icontrol but instead update of current policy new policie with suffix _number is created.

Steps what I have done:

Files has been uploaded (policy definition + swagger file) to the endpoint /mgmt/tm/asm/file-transfer/uploads/

Policy is created with:

/mgmt/tm/asm/tasks/import-policy/", '{"filename": "sp_test_api.json", "name":"sp_test_api_baseline"}'

When I changed something in swagger file and try to update policy with same steps then new policy sp_test_api_baseline_1 is created.

 

Tested with simple policy

 

{
   "policy" : {
      "applicationLanguage" : "utf-8",
      "caseInsensitive" : true,
      "description" : "",
      "enablePassiveMode" : false,
      "enforcementMode" : "transparent",
      "protocolIndependent" : false,
      "fullPath" : "/Common/sp_test_api_baseline",
      "name" : "sp_test_api_baseline",
      "softwareVersion" : "16.1.2",
      "open-api-files": [
        {
          "filename": "file://swagger.json"
        }
        ],
      "template" : {
         "name" : "POLICY_TEMPLATE_API_SECURITY"
      },
      "type" : "security"
   }
}

 

Any idea why new policy is always created?

  • Try this (untested):

    {
      "fileName": "sp_test_api.json",
      "policy":{
        "fullPath": "/Common/sp_test_api_baseline",
       }
    }

    I personally do not upload the policy, but use file references:

    {
      "fileReference":{
        "link": http://webserver/policy.json
      },
      "policy":{
        "fullPath": "/Common/sp_test_api_baseline",
      }
    }

     

1 Reply

  • Try this (untested):

    {
      "fileName": "sp_test_api.json",
      "policy":{
        "fullPath": "/Common/sp_test_api_baseline",
       }
    }

    I personally do not upload the policy, but use file references:

    {
      "fileReference":{
        "link": http://webserver/policy.json
      },
      "policy":{
        "fullPath": "/Common/sp_test_api_baseline",
      }
    }