f5-common-python
f5-common-python copied to clipboard
Error when updating an object that is created within a Transaction
It looks like there is an issue in the TransactionContextManager function used to wrap different rest calls into a transaction. When I attempt to modify an object that is created within a transaction an error message is returned.
From what I can tell when an object is updated the _meta_data['uri'] attribute incorrectly refers to the URI path of the transaction instead of the URI path of the object that will be created.
Using the snippet below pool._meta_data['uri'] == 'https://10.10.1.202:80/mgmt/tm/transaction/1507766047230839/commands/1/' but in order to modify the object within the transaction the _meta_data['uri'] path is expected to be 'https://10.10.1.202:80/mgmt/tm/ltm/pool/pool_1/'
Code Snippet:
from f5.bigip import ManagementRoot
mgmt = ManagementRoot(hostname='10.10.1.202', port='80', username='myUsername', password='myPassword')
transaction = mgmt.tm.transactions.transaction
with TransactionContextManager(transaction, validate_only=False) as tx:
pool = tx.tm.ltm.pools.pool.create(name='pool_1')
pool.update(description = 'pool_descr')
Error:
Text: u'{"code":400,"message":"Found invalid command id 1/","errorStack":[],"apiError":1}'
@rotelly and I verified this offline. I will be handling it's fix
@caphrim007 any status on this ?
I have also run into this issue on a rather recent version, is there a workaround available ?