1
0
mirror of https://github.com/rancher/os.git synced 2025-09-04 08:14:21 +00:00
Files
os/pkg/init/bootstrap/bootstrap.go
Lonnie Liu 6cde287f87 make golang files to pass the latest go lints
- use constructors with named fields
- fix logf statements
2021-02-18 20:17:50 +02:00

40 lines
984 B
Go

package bootstrap
import (
"github.com/burmilla/os/config"
"github.com/burmilla/os/pkg/compose"
"github.com/burmilla/os/pkg/init/docker"
"github.com/burmilla/os/pkg/log"
"github.com/burmilla/os/pkg/sysinit"
"github.com/burmilla/os/pkg/util"
)
func bootstrapServices(cfg *config.CloudConfig) (*config.CloudConfig, error) {
if util.ResolveDevice(cfg.Rancher.State.Dev) != "" && len(cfg.Bootcmd) == 0 {
log.Info("NOT Running Bootstrap")
return cfg, nil
}
log.Info("Running Bootstrap")
_, err := compose.RunServiceSet("bootstrap", cfg, cfg.Rancher.BootstrapContainers)
return cfg, err
}
func Bootstrap(cfg *config.CloudConfig) error {
log.Info("Launching Bootstrap Docker")
c, err := docker.Start(cfg)
if err != nil {
return err
}
defer docker.Stop(c)
_, err = config.ChainCfgFuncs(cfg,
[]config.CfgFuncData{
{Name: "bootstrap loadImages", Func: sysinit.LoadBootstrapImages},
{Name: "bootstrap Services", Func: bootstrapServices},
})
return err
}