pkg/podman: Wrap 'podman system migrate'

https://github.com/containers/toolbox/pull/318
This commit is contained in:
Harry Míchal 2020-05-08 20:40:23 +02:00 committed by Debarshi Ray
parent 46c21a5c14
commit d1a9fe20aa
1 changed files with 14 additions and 0 deletions

View File

@ -74,3 +74,17 @@ func GetVersion() (string, error) {
func SetLogLevel(logLevel logrus.Level) {
LogLevel = logLevel
}
func SystemMigrate(ociRuntimeRequired string) error {
logLevelString := LogLevel.String()
args := []string{"--log-level", logLevelString, "system", "migrate"}
if ociRuntimeRequired != "" {
args = append(args, []string{"--new-runtime", ociRuntimeRequired}...)
}
if err := shell.Run("podman", nil, nil, nil, args...); err != nil {
return err
}
return nil
}