f5-common-python
f5-common-python copied to clipboard
Partition Inconsistency with Rules in Common
If an iRule in the 'Common' partition is loaded without specifying the partition (defaulting to 'Common') the partition property is missing from the returned object and the fullPath property does not include the partition:
rule = mgmt.tm.ltm.rules.rule.load(name='foo')
pprint(rule.raw)
# Omitted _meta_data for brevity
{'apiAnonymous': 'when HTTP_REQUEST {\n'
' HTTP::respond 307 Location '
'"https://[HTTP::host][HTTP::uri]"\n'
'}',
'fullPath': 'foo',
'generation': 714032,
'kind': 'tm:ltm:rule:rulestate',
'name': 'foo',
'selfLink': 'https://localhost/mgmt/tm/ltm/rule/foo?ver=11.6.0'}
If the partition is specified data is as expected:
rule = mgmt.tm.ltm.rules.rule.load(partition='Common', name='foo')
pprint(rule.raw)
# Omitted _meta_data for brevity
{'apiAnonymous': 'when HTTP_REQUEST {\n'
' HTTP::respond 307 Location '
'"https://[HTTP::host][HTTP::uri]"\n'
'}',
'fullPath': '/Common/foo',
'generation': 714032,
'kind': 'tm:ltm:rule:rulestate',
'name': 'foo',
'partition': 'Common',
'selfLink': 'https://localhost/mgmt/tm/ltm/rule/foo?ver=11.6.0'}
What is your desired state @jbnance?
Not everyone uses partitions, so if we require it as a kwarg, that's frustrating for a lot of people. At the same time, we don't have direct control of the rest interface that isn't returning the partition as an attribute when not specified in the request. It's odd, because I would assume on a system without partitions other than Common this is ok. But I have a test system with Common and bc, and an iRule named rand_pool in both of them. If I just request by name, the system assumes Common and returns that iRule, but doesn't tell me that by setting the attribute.
I say all this to say...are you requesting we:
- require partition as a kwarg on all resources?
- in the absence of partition kwarg we add to the request and assume Common?
My ask is purely about the returned data. I request that the partition property is always included in the returned object and that the fullPath property always include the partition. That is how virtual servers, pools. nodes, monitors, etc, etc currently behave.
If that means that the SDK always sends the partition in the request I think that defaulting to "Common" is the right approach (not requiring the kwarg). It seems that maybe this is really an API bug, not an SDK bug, but sounds like it would be easy to mitigate in the SDK.
This same situation exists for monitors as well. Shall I open a new issue or modify this request?
I would suggest doing this in the endpoints in question not in the Resource class @jasonrahm