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
Replace caps.FileType with caps.BoolFile with required "path" #206
Conversation
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This patch ensures, via caps.Type.Validate(), that capabilities have only attributes that are expected. The actual value of attributes is not checked, just their presence. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
CI failed because the corresponding part of #205 is not merged, I'll change that in a sec. |
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
// | ||
// This capability type can be used to describe many boolan flags exposed | ||
// in sysfs, including certain hardware like exported GPIO pins. | ||
BoolFileType = &Type{ |
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.
Maybe this is more a question for Gustavo, not sure. But is there anything that enforces that BoolFile is a bool file (or will there be anything)? Right now it seems like I could also use it for other files in sysfs or dev. Will there be a DecimalFileType for files like /proc/sys/vm/swappiness that accept a numeric range of parameters? Just curious to understand the longer term vision better .)
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This patch kills the early development "file" type and replaces it with the "bool-file" type that can be used to describe simple GPIO pins. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
👍 |
This looks good, but pending work on the underlying branch. |
One question, how will this look in the future? Will the fact that its a BoolFile with only 0/1 be enforced in some way by snappy? Or is it just a label for the user/developer? |
@mvo5 In the future each type will be a standalone entity that is loaded at start-up. Types will be documented (along with the semantics for application developers). Snappy will not enforce what an application does but I hope to have a library for popular languages for working with capabilities with cleaner APIs than the roll-your-own one might look like. |
Replace caps.FileType with caps.BoolFile with required "path"
This branch depends on #205
This patch kills the early development "file" type and replaces it with
the "bool-file" type that can be used to describe simple GPIO pins.