01070621:3: Rule priorities error despite unique priorities !

Fellow pycontrol-freaks :slight_smile:

I’ve been on a coding marathon for 2 days and have had a fantastic time diving into pycontrol !!

I’m trying to use it to dynamically add a maintenance irule and then remove it again based on a ruby script that’s out on devcentral.

However, I’m running into a wall finally and it smells like a bug or massively misleading API error to me.

I know that icontrol is stricter than the gui and won’t let me add 2 irules with the same priority except I can prove to you that it does anyway whereas I cannot add a 3rd iRule

if 2 exist already no matter what the priorities are.

Case in point. I have a test vs with no irules. I can use my pycontrol script to add a redirect rule no problem.

***********************

SCENARIO 1 (works when it shouldn’t) :

[stucky@vito pycontrol]$ ./maintenance.py blablabla

The iRule ‘api_maintenance’ already existed but got refreshed.

Successfully added iRule ‘api_maintenance’ to virtual server ‘/Common/test’

The irule is set to priority 1 :

[root@stglbltm01:Active:Standalone] config tmsh show ltm rule api_maintenance

---------------------------------------------

Ltm::Rule Event: api_maintenance:HTTP_REQUEST

---------------------------------------------

Priority 1

Executions

Now as per docs I should not be able do this again if another rule with pri 1 already exists. To test let’s remove this rule again and manually add the test rule with pri 1.

[root@stglbltm01:Active:Standalone] config tmsh list ltm virtual test

ltm virtual test {

destination ip:http

ip-protocol tcp

mask 255.255.255.255

profiles {

http { }

tcp { }

}

rules {

test_hipri

}

[root@stglbltm01:Active:Standalone] config tmsh show ltm rule test_hipri

----------------------------------------

Ltm::Rule Event: test_hipri:HTTP_REQUEST

----------------------------------------

Priority 1

Executions

Ok now let’s try to use pycontrol to add the maintenance rule again:

[stucky@vito pycontrol]$ ./maintenance.py blablabla

The iRule ‘api_maintenance’ already existed but got refreshed.

Successfully added iRule ‘api_maintenance’ to virtual server ‘/Common/test’

Let’s confirm we have both rules associated with the vs:

[root@stglbltm01:Active:Standalone] config tmsh list ltm virtual test

ltm virtual test {

destination ip:http

ip-protocol tcp

mask 255.255.255.255

profiles {

http { }

tcp { }

}

rules {

test_hipri

api_maintenance

}

Now I don’t mind if something works that shouldn’t as much as I do when something doesn’t work that should !

**************************

SCENARIO 2 (Doesn’t work when it really should !!)

Let’s add 2 irules to this vs both with DIFFERENT priorities (other than 1 for sure !):

[root@stglbltm01:Active:Standalone] config tmsh list ltm virtual test

ltm virtual test {

destination ip:http

ip-protocol tcp

mask 255.255.255.255

profiles {

http { }

tcp { }

}

rules {

log_persistence_cookie

filter_http_methods

}

We have pri 800 and pri 10.

[root@stglbltm01:Active:Standalone] config tmsh show ltm rule log_persistence_cookie

----------------------------------------------------

Ltm::Rule Event: log_persistence_cookie:HTTP_REQUEST

----------------------------------------------------

Priority 800

Executions

[root@stglbltm01:Active:Standalone] config tmsh show ltm rule filter_http_methods

-------------------------------------------------

Ltm::Rule Event: filter_http_methods:HTTP_REQUEST

-------------------------------------------------

Priority 10

Executions

According to the docs I should have no problem adding a 3rd irule with priority 1 here via pycontrol so let’s try :

[stucky@vito pycontrol]$ ./maintenance.py blablab

The iRule ‘api_maintenance’ already existed but got refreshed.

No handlers could be found for logger “suds.client”

Server raised fault: 'Exception caught in LocalLB::urn:iControl:LocalLB/VirtualServer::add_rule()

Exception: Common::OperationFailed

primary_error_code : 17237537 (0x01070621)

secondary_error_code : 0

error_string : 01070621:3: Rule priorities for virtual server (/Common/test) must be unique.’

This totally hoses me cause I cannot finish my maintenance script testing now. It’s all moot if I can’t get this rule added/removed on the fly.

Please tell me I’m doing something wrong !

Keep up the great forum !

thx