Rule Actions are not set properly when creating a Rule with Perl CLI

Document ID : KB000005244
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

I have created a Rule by using the Perl CLI using the following code:

$rule=$realm->CreateRule("TEST",
"TEST Rule",
"GET,POST",
"TEST/*"
);

The Rule is correctly created and I can see it in the AdminUI. If I click on the "View" button to see the Rule, I see still the Rule with the expected configuration. But if I click on "Modify" button for this Rule, in the method selection box, no action gets selected. In order to make the Rule applicable, I need to select the methods manually and save the changes in the AdminUI. So each time I create a Rule with the Perl CLI, I need to select the methods in the AdminUI after. If not, the Rule won't be applied. Every Rule I create with the CLI have the same behavior.

Environment:
Policy Server R12.52 SP1
Cause:

The Rule Actions to be applied need to have the same syntax as per the Agent Type of the Agent. In your case, the Agent has "Agent Type" "Web Agent". In AdminUI, if you go to Agent / Agent Types and select "Web Agent", then you'll see Actions as "Get", "Post", "Put".

Resolution:

In your Perl CLI script, if you pass the actions as "Get,Post" instead of "GET,POST", then the Rule will be applied, and you'll see in the Rule definition these actions selected in method selection box.

The code will look like this :

$realm->CreateRule("TEST",
"TEST Rule",
"Get,Post",
"TEST/*"
);