-
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
Added compatibility with operations project values #344
Conversation
the LXD Rest api returns an operation id with the query string ?project=default to notify in which project the operation belongs. This was not sufficiently cut away by .split('/')[-1] but also needed a subsequent .split('?')[0] The Mock_lxd has been adapted to test for this feature In the container.execute the operation_id is needed directly, where it is fixed too Signed-off-by: Felix Engelmann <fe-github@nlogn.org>
Codecov Report
@@ Coverage Diff @@
## master #344 +/- ##
==========================================
+ Coverage 96.83% 96.84% +0.01%
==========================================
Files 12 12
Lines 980 984 +4
Branches 110 109 -1
==========================================
+ Hits 949 953 +4
Misses 12 12
Partials 19 19
Continue to review full report at Codecov.
|
This is nice; however, I do have a concern. I'm guessing that the import urllib.parse
urllib.parse.parse_qs("https://hello.com/the/part?hello=one&project=10")
{'https://hello.com/the/part?hello': ['one'], 'project': ['10']} |
Signed-off-by: Felix Engelmann <fe-github@nlogn.org>
I agree that split is NOT the right tool. Unfortunately it is used throughout the hole project :( |
Hey @felix-engelmann, yes, I agree split is used everywhere! :) I'm not one of the original maintainers, but only the most recent. I like to try an encourage a bit of "code gardening" to see if we can improve things, and sometimes take it a bit far!! Sorry if the request looked a bit strange in the context of the rest of the code. My thinking went a bit like this: the original code used a |
How do you like my static method in Operation to extract the operation id? And in general, I saw that you are planning a major revision for version 3. Do you want a complete rewrite? Because then it would make little sense to put a lot of effort into this version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. Thanks!
Yes, that's good.
It's not going to be a complete re-write, but perhaps a different set of API calls. i.e. this version will continue for all the code that relies on it. A lot of the 'smart' code in the library will probably be re-used, but it'll take less of a 'object orientated' approach, and more of a functional approach; i.e. removing the 'sync' function, and thus respecting that the contents of a returned 'object' are only valid at the point that it is returned. So, no 'modify and object and save it', rather "send the changes as per the API". However, there's not much urgency around a version 3.0, and so version 2.0 is still where it is at :) It's more my dream of how it might be better. |
the LXD Rest api returns an operation id with the query string
?project=default
to notify in which project the operation belongs. Thiswas not sufficiently cut away by
.split('/')[-1]
but also needed a subsequent
.split('?')[0]
The Mock_lxd has been adapted to test for this feature
In the
container.execute
theoperation_id
is needed directly, where itis fixed too
Signed-off-by: Felix Engelmann fe-github@nlogn.org