-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Issue #2730 - better handle types for expanded variables #2759
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
Conversation
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.
I'm not sure why this is necessary. On windows I would expect os.path to return the correct paths.
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.
the if sys.platform == "win32": was here in the code I moved ...
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.
Ah yes, I saw that, but I'm not sure why it's there either. This is mostly just a question, it may be necessary. If you can remove it and the appveyor tests pass (they run on windows) then I think it's safe to remove.
|
I'll try to integrate the feedback asap and will resubmit. |
compose/config/interpolation.py
Outdated
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 seems overly complex. I think supporting arrays is probably the most contentious part of this feature. I think we should try to keep it as straightforward as possible.
How about:
return json.loads(interpolated_value)Although, I wonder if it should actually be yaml.safe_load() since the config is yaml format. Using yaml would support json as well.
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.
As I said I have not written python for years, but it seems that json.loads does not work with an Array.
Looks like I am not the only one to face the issue
=> http://stackoverflow.com/questions/10973614/convert-json-array-to-python-list
However, it may be just because of issue between simple quotes (') and double quotes (")
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.
I think that's it. json only supports double quotes for strings.
|
Thanks for the PR! I think it's on the right track. We'll need some time to discuss it for the 1.7 release, so it might be another couple weeks before we can give any more design feedback. |
|
What is the preferred process on your side :
NB : I know this is a kind a "religious" question, so I prefer to ask before doing something inappropriate :) |
|
New commits are fine. You may be asked to squash at the end, right before merging. Or you could also squash them now if you think it's warranted. |
|
Here is a new version. I say most, because while changing the code I realized that some cases where not handled, so I added more tests and adapted the implementation. |
|
Not sure I understand the problem on the Jenkins build: it is related to my changes or can it come from other changes ? |
|
They look unrelated |
|
Ok, should I do something to restart the build / check ? |
|
Looks like I need to rebase my changes ... will do it when I find the time |
Signed-off-by: Thierry Delprat <tdelprat@nuxeo.com>
Signed-off-by: Thierry Delprat <tdelprat@nuxeo.com>
Signed-off-by: Thierry Delprat <tdelprat@nuxeo.com>
|
Any progress @tiry? Since this PR is solving #2750, it would be great for nvidia-docker. Thank you for your work! |
|
I did a rebase (+fixes) and everything seems to work on my side ... let's see what you CI says ! |
|
It does not look like the build failure is related to my code. |
|
I don't know how the CI works for |
Signed-off-by: Thierry Delprat <tdelprat@nuxeo.com>
|
Fair enough, I was just looking for a cleaner option. |
|
Failed again so the error does not seem to be transient. Thank you ! |
|
yes, the failures are unrelated, i've started another build now that the issue should be fixed. |
|
Great, let me know if you have further feedback ! |
|
I could rebase once more, but I would need to have some feedback from you guys otherwise this is kind of pointless. |
|
Yup, don't worry about rebasing just yet, we'll need to look over it again |
|
Any status on review of this PR? I'm here coming from the same nvidia-docker related camp (#2750 and NVIDIA/nvidia-docker#39) as @flx42 . |
Here is a changeset to handle automatic cast based on the types defined in the jsonschema.
I added test for my use case as well as for #2750.
My python is pretty rusted, but it seems to work as expected ... let me know what you think.