-
Notifications
You must be signed in to change notification settings - Fork 160
validate.go add checkos #332
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
4a08bf7 to
d1898f7
Compare
|
I will add the |
validate/validate.go
Outdated
|
|
||
| if v.spec.Platform.OS != "linux" { | ||
| if v.spec.Linux != nil { | ||
| msgs = append(msgs, fmt.Sprintf("When system is not linux, Linux field should be empty")) |
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 not supported by any spec wording, which only SHOULDs the setting (and says nothing about unsetting) the platform-specific sections based on platform.os.
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.
But spec has changed in this PR.
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.
But spec has changed in this PR.
Ah, I'd missed that (that PR changed a lot ;). I'm not sure how the new approach will scale to a vm section if/when VM support lands in the spec, but I guess we'll see.
Anyhow, thanks for re-citing master. I'm fine with your implementation landing as soon as runtime-tools switches from targeting v1.0.0-rc4 (which has the old language) to rc5 (or whichever spec release we target next which has the new language).
As a minor nit, I'd recommend wording that more closely follows the spec. Something like:
msgs = append(msgs, fmt.Sprintf("'linux' MUST NOT be set when platform.os is %q", v.spec.Platform.OS))
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.
updated,thanks for your advice.
validate/validate.go
Outdated
|
|
||
| if v.spec.Platform.OS != "linux" { | ||
| if v.spec.Linux != nil { | ||
| msgs = append(msgs, fmt.Sprintf("'linux' MUST NOT set when platform.os is %q", v.spec.Platform.OS)) |
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.
nit: MUST NOT be set
validate/validate.go
Outdated
|
|
||
| if v.spec.Platform.OS != "solaris" { | ||
| if v.spec.Solaris != nil { | ||
| msgs = append(msgs, fmt.Sprintf("'solaris' MUST NOT set when platform.os is %q", v.spec.Platform.OS)) |
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.
Same here.
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.
updated, PTAL
Signed-off-by: zhouhao <[email protected]>
I think we should increase the judgment of several OS.
https://github.com/opencontainers/runtime-spec/blame/master/config.md#L324
Signed-off-by: zhouhao [email protected]