Merge d5256cb214
into 1df8e6638b
This commit is contained in:
commit
cfb6d9f71a
2 changed files with 32 additions and 0 deletions
|
@ -175,6 +175,10 @@ func main() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := config.Check(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
cf := &logrus.TextFormatter{
|
cf := &logrus.TextFormatter{
|
||||||
TimestampFormat: "2006-01-02 15:04:05.000000000Z07:00",
|
TimestampFormat: "2006-01-02 15:04:05.000000000Z07:00",
|
||||||
FullTimestamp: true,
|
FullTimestamp: true,
|
||||||
|
|
|
@ -2,7 +2,9 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
)
|
)
|
||||||
|
@ -169,3 +171,29 @@ func (c *Config) ToFile(path string) error {
|
||||||
|
|
||||||
return ioutil.WriteFile(path, w.Bytes(), 0644)
|
return ioutil.WriteFile(path, w.Bytes(), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check resolves that all paths and files are available as expected
|
||||||
|
func (c *Config) Check() error {
|
||||||
|
for _, file := range []string{
|
||||||
|
c.RootConfig.SandboxDir,
|
||||||
|
c.RootConfig.ContainerDir,
|
||||||
|
c.RuntimeConfig.Runtime,
|
||||||
|
c.RuntimeConfig.Conmon,
|
||||||
|
c.RuntimeConfig.SeccompProfile,
|
||||||
|
c.ImageConfig.Pause,
|
||||||
|
} {
|
||||||
|
if _, err := os.Stat(file); err != nil && os.IsNotExist(err) {
|
||||||
|
return checkError{Path: file}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type checkError struct {
|
||||||
|
Path string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ce checkError) Error() string {
|
||||||
|
return fmt.Sprintf("%q does not exist", ce.Path)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue