-
Notifications
You must be signed in to change notification settings - Fork 351
TOSession - Error when calling TOSession.get_parameters_by_profile_id #6589
Description
This Bug Report affects these Traffic Control components:
- Traffic Control Client - Python
Current behavior:
When calling TOSession.get_parameters_by_profile_id with a valid profile_id, an error is received. The code used was as follows:
with TOSession(ats_host, verify_cert=verify_cert) as traffic_ops_api:
traffic_ops_api.login(to_user, to_pass)
profiles = traffic_ops_api.get_profiles()[0]
src = profiles[1]
params = traffic_ops_api.get_parameters_by_profile_id(profile_id=src.id)
And the error:
ERROR:trafficops.restapi:restapi.py:_build_endpoint:344: Expecting a value for keyword argument ['id'] for format field specification ['profiles/{id:d}/parameters']
ERROR:root:Expecting a value for keyword argument ['id'] for format field specification ['profiles/{id:d}/parameters']
Traceback (most recent call last):
File "/path/to/apache-trafficcontrol-6.0.2/traffic_control/clients/python/trafficops/restapi.py", line 339, in _build_endpoint
new_api_path = api_path.format(**url_params) + qparams
KeyError: 'id'
ValueError: Expecting a value for keyword argument ['id'] for format field specification ['profiles/{id:d}/parameters']
The decorator for method get_parameters_by_profile_id is using a different variable to the one defined in the method ( profile_id vs id ).
Expected behavior:
A list of parameters should be returned.
Steps to reproduce:
The following code could be used to reproduce the issue:
with TOSession(ats_host, verify_cert=verify_cert) as traffic_ops_api:
traffic_ops_api.login(to_user, to_pass)
profiles = traffic_ops_api.get_profiles()[0]
src = profiles[1]
params = traffic_ops_api.get_parameters_by_profile_id(profile_id=src.id)