Extract a single profile parameter for a specifc hostname

9 views
Skip to first unread message

Steve Malenfant

unread,
Aug 23, 2016, 11:53:53 AM8/23/16
to traffic_control-discuss
When running Ansible playbooks, we would like to query a specific parameter for a server using the `uri` module. We currently can only get the whole profile and it is quite time consuming and requires iteration over the whole profile. 

I currently use this API endpoint `GET /api/1.2/parameters/profile/:name.json`

I would like to be able to key on the following, is this possible today?

- server hostname
- name
- config_file

Example, trying to get to the following :

name: CONFIG proxy.config.cache.ram_cache.size
config_file: records.config

Thanks,

Steve

Jeremy Mitchell

unread,
Aug 23, 2016, 1:22:58 PM8/23/16
to Steve Malenfant, traffic_control-discuss
I don't believe there is an api to do what you want but I suppose the GET /api/1.2/parameters/profile/:name.json api endpoint could be enhanced to support a couple of optional query params that would serve as filters. kind of like this:

GET /api/1.2/parameters/profile/:name.json?paramName=X&configFile=Y

Would that work? If so, do you want to create an issue for it and mark it as "Traffic Ops" and "enhancement"?

Jeremy

--
You received this message because you are subscribed to the Google Groups "traffic_control-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to traffic_control-discuss+unsub...@googlegroups.com.
To post to this group, send email to traffic_control-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/traffic_control-discuss/25d56e02-82f6-4a3a-9d74-a19da68fdc52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Malenfant

unread,
Aug 23, 2016, 2:49:23 PM8/23/16
to traffic_control-discuss, smale...@gmail.com
That would work as long as it can take those long key names.

Would you know what the "cachegroup" association means in the parameter table? Does that mean you can assign a parameter to a cache group instead of a profile? If that's the case, would the proposed enhancement still work?

Thanks,

Steve

Jeremy Mitchell

unread,
Aug 23, 2016, 3:58:47 PM8/23/16
to traffic_control-discuss, smale...@gmail.com
I think the long key names should be fine...

cachegroup parameters are parameters assigned to all servers within that cachegroup. 
profile parameters are parameters assigned to all servers with that profile. 

GET /api/1.2/parameters/profile/:name.json fetches profile parameters. there appears to be no api to fetch cachegroup parameters. so yes, the proposed solution (GET /api/1.2/parameters/profile/:name.json?paramName=X&configFile=Y) would not help you with "cachegroup parameters"

maybe a better solution would be to add some optional query params to the existing GET /api/1.2/parameters.json api like this:

GET /api/1.2/parameters.json?[profile=x|cachegroup=y]&paramName=X&configFile=Y
Reply all
Reply to author
Forward
0 new messages