*** VW_ has quit IRC | 03:45 | |
*** VW has joined #craton | 03:46 | |
*** VW has quit IRC | 05:16 | |
*** openstackgerrit has quit IRC | 08:03 | |
*** klindgren has quit IRC | 10:22 | |
*** klindgren has joined #craton | 10:23 | |
*** VW has joined #craton | 11:35 | |
*** VW has quit IRC | 12:12 | |
thomasem | Goooood morning | 13:37 |
---|---|---|
jimbaker | thomasem, morning! | 13:46 |
anonymike | o/ | 13:56 |
*** VW has joined #craton | 14:10 | |
*** Syed__ has joined #craton | 14:41 | |
jimbaker | so we will have our usual meeting in a couple of minutes | 14:58 |
jimbaker | expect it to be short/pro forma | 14:58 |
jimbaker | i will start the process of canceling them out as we figure out transition | 14:58 |
*** Tamayo has joined #craton | 15:37 | |
anonymike | relocating | 15:39 |
thomasem | Mmmmmkay | 15:42 |
*** VW has quit IRC | 15:46 | |
*** VW has joined #craton | 15:46 | |
sulo | sorry i missed todays meeting but looks like good decisions made | 16:21 |
jimbaker | sulo, np, and thanks for reviewing those decisions | 16:55 |
*** Syed__ has quit IRC | 16:55 | |
*** harlowja has joined #craton | 18:12 | |
anonymike | thomasem: was host-list --detail ever working? | 19:33 |
thomasem | anonymike: It should have been https://github.com/openstack/python-cratonclient/blob/master/cratonclient/shell/v1/hosts_shell.py#L144, but I can't remember testing it specifically. | 19:34 |
anonymike | i just spun up a new env and I keep getting ERROR: The request sent to the server was invalid. when passing --detail | 19:35 |
thomasem | Interesting | 19:35 |
thomasem | OH | 19:35 |
thomasem | Hold up | 19:35 |
anonymike | i fixed it in my code by setting it to details | 19:35 |
anonymike | but even then the variables aren't printing out :/ | 19:35 |
thomasem | ... details in the API request? | 19:35 |
thomasem | What was being passed to the API? | 19:36 |
anonymike | "detail" | 19:36 |
anonymike | to get it to not error i changed to "details" | 19:36 |
thomasem | What about for, say, regions-list --detail? | 19:36 |
anonymike | https://github.com/openstack/python-cratonclient/blob/master/cratonclient/shell/v1/hosts_shell.py#L149 | 19:36 |
thomasem | Huh | 19:37 |
anonymike | thats an error on fresh build | 19:37 |
thomasem | https://github.com/openstack/python-cratonclient/blob/master/cratonclient/shell/v1/regions_shell.py#L116 | 19:37 |
thomasem | https://github.com/openstack/craton/blob/master/craton/api/v1/schemas.py#L957 | 19:37 |
*** harlowja has quit IRC | 19:37 | |
thomasem | yeah because it's expecting "details", like you set. | 19:37 |
thomasem | But, it should be returning with vars: https://github.com/openstack/craton/blob/master/craton/api/v1/resources/inventory/hosts.py#L23 | 19:39 |
thomasem | hmmmm | 19:39 |
anonymike | yep, and even after that it's returning the variable manager | 19:39 |
anonymike | ive traced it in the client | 19:39 |
thomasem | Do you get the variables when you hit the API without the client? | 19:40 |
thomasem | and set details=all? | 19:40 |
thomasem | or 'true' or whatever | 19:40 |
anonymike | yes | 19:40 |
anonymike | https://github.com/openstack/python-cratonclient/blob/master/cratonclient/crud.py#L121 | 19:40 |
anonymike | i have all the variables until then | 19:40 |
anonymike | then it does the resource class hides em | 19:40 |
thomasem | Can you try hosts.to_dict()['variables'] and see what's there? | 19:41 |
anonymike | on the generator? | 19:42 |
thomasem | anonymike: Sorry, that's right, it's a generator. Then host.to_dict()['variables'] for each item from the generator. | 19:43 |
thomasem | [host.to_dict()['variables'] for host in hosts] | 19:43 |
thomasem | And see what's there. | 19:43 |
anonymike | right, just ran that and it looks like i have all the variables when I do that but its the object otherwise | 19:43 |
anonymike | just a moment let me check again | 19:44 |
thomasem | So, this is a problem with the way a resource model is abstractly constructed from the API response and overlayed on a Python class. | 19:44 |
thomasem | But, when we went to add Variable management via the CLI, we needed to have some way to access the variables to put/delete on the variables for a resource. | 19:45 |
thomasem | So, resource.variables is a VariableManager instead of the resp.json()['variables'] from the API response for that resource. | 19:45 |
anonymike | So I think I can easily fix this by converting to dict in the table formatter | 19:45 |
anonymike | would that be okay? | 19:45 |
thomasem | Therefore, I would recommend using resource.to_dict() | 19:45 |
anonymike | it already works in json formatting | 19:45 |
thomasem | instead of resource.<attribute> | 19:45 |
anonymike | cool | 19:45 |
thomasem | jimbaker: thoughts ^^? | 19:46 |
thomasem | Yeah.. it's not ideal | 19:46 |
thomasem | But, those were the limitations of the implemented pattern, I'm afraid. | 19:46 |
thomasem | I suppose we could have gone with something like resource.variable_mgr.[update, delete] | 19:46 |
anonymike | also... why did the tests miss the error for calling details? :/ | 19:46 |
thomasem | Tests need some shoring up on that front. | 19:47 |
jimbaker | tests are never perfect | 19:47 |
jimbaker | anyway, the approach sounds good to me - we want to work with the api as it is, not revisit. that took a bit of work | 19:48 |
thomasem | anonymike: so, yeah, seems alright to use resource.to_dict() instead. | 19:48 |
anonymike | cool | 19:48 |
thomasem | Sorry for the pain there. I know it's not ideal. :( | 19:48 |
anonymike | wew that threw me for quite the loop tracing it back lol | 19:48 |
thomasem | I can imagine. | 19:48 |
thomasem | thanks jimbaker! | 19:49 |
anonymike | helped me understand the flow a lot though so good exercise | 19:49 |
anonymike | yeah thanks guys | 19:49 |
thomasem | Good positive spin there. :P | 19:49 |
thomasem | Agreed | 19:49 |
jimbaker | :) | 19:49 |
*** harlowja has joined #craton | 20:53 | |
*** VW_ has joined #craton | 22:29 | |
*** VW has quit IRC | 22:32 | |
*** VW_ has quit IRC | 22:33 |
Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!