rkt: Fix incomplete selinux context string when the option is partial.

Add Getfilecon() into the selinux interface.
This commit is contained in:
Yifan Gu
2016-06-06 16:23:16 -07:00
parent e49e367cd1
commit 8596d25ad5
6 changed files with 61 additions and 33 deletions

View File

@@ -16,12 +16,14 @@ limitations under the License.
package selinux
// chconRunner knows how to chcon a directory.
type ChconRunner interface {
// SelinuxContextRunner knows how to chcon of a directory and
// how to get the selinux context of a file.
type SelinuxContextRunner interface {
SetContext(dir, context string) error
Getfilecon(path string) (string, error)
}
// newChconRunner returns a new chconRunner.
func NewChconRunner() ChconRunner {
return &realChconRunner{}
// NewSelinuxContextRunner returns a new chconRunner.
func NewSelinuxContextRunner() SelinuxContextRunner {
return &realSelinuxContextRunner{}
}