-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with transactions using f5-sdk 1.3.1 and 11.6.1 #641
Comments
@chen23 how about deleting the
instead? |
Instead of directly calling |
Here's the output with the suggested changes:
|
@chen23 do you have code I can use to reproduce? |
And I! |
This is a breaking change introduced in requests 2.11 https://github.com/kennethreitz/requests/issues/3477 |
Issues: Fixes F5Networks#641 Problem: requests 2.11 changed compatibility to disallow integers inside of headers. The result was that the transaction functionality in the SDK broke because transaction IDs are integers and sent in the headers of the request (X-F5-REST-Coordination-Id). Analysis: This patch casts the integers to strings to correct the problem. Tests: none
A bit late. Here's the code: https://github.com/f5devcentral/f5-icontrol-codeshare-python/tree/master/pcf-example, use pcf-phase1.py. The issue had two issues: 1. transaction ID in header 2. URI getting mangled during a transaction. Let me know if I should open a new ticket for the second issue, reopen, or leave my code as-is. Thanks. |
Thanks @chen23 for your fixes ! I tried to create a virtual server with a member using a same transaction. Using
Code to reproduce host = os.getenv("BIGIP_BENCH_HOST")
user = os.getenv("BIGIP_BENCH_USER")
password = os.getenv("BIGIP_BENCH_PASSWORD")
mgmt = ManagementRoot(host, user, password)
tx = mgmt.tm.transactions.transaction
with TransactionContextManager(tx) as api:
https_monitor = api.tm.ltm.monitor.https_s.https.create(name="MyHttpsMonitor")
# create a node
node = api.tm.ltm.nodes.node.create(name="MyNode", address="1.2.3.4")
# create a pool
pool_name = "MyPool"
partition = "Common"
pool = api.tm.ltm.pools.pool.create(
name=pool_name,
loadBalancingMode="round-robin",
monitor="MyHttpsMonitor",
partition=partition
)
# Fixes {"code":400,"message":"Found invalid command id 3/members/","errorStack":[],"apiError":1}
# pool._meta_data['uri'] = pool._meta_data['uri'].split("/transaction/")[0] + "/ltm/pool/~%s~%s/" %(partition, pool_name)
# create a pool member - inherit monitor from pool.
member = pool.members_s.members.create(
name="MyNode:42", address="1.2.3.4", partition="Common"
)
# create vip
vip = api.tm.ltm.virtuals.virtual.create(
name="MyVip", pool=pool_name, source="0.0.0.0/0", destination="1.2.3.4:42"
) |
Testing on 11.6.1 w/ f5-sdk 1.3.1 ran into two issues with transactions
I've patched my code to workaround the issues, not sure the best way to handle for the F5 Python SDK
Errors seen:
Code that avoids errors:
The text was updated successfully, but these errors were encountered: