f5-common-python icon indicating copy to clipboard operation
f5-common-python copied to clipboard

Error when updating an object that is created within a Transaction

Open r-teller opened this issue 8 years ago • 3 comments

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}'

r-teller avatar Oct 11 '17 23:10 r-teller

@rotelly and I verified this offline. I will be handling it's fix

caphrim007 avatar Oct 12 '17 01:10 caphrim007

@caphrim007 any status on this ?

wojtek0806 avatar Aug 08 '18 10:08 wojtek0806

I have also run into this issue on a rather recent version, is there a workaround available ?

jllorente avatar Oct 14 '19 15:10 jllorente