123456789101112131415161718192021222324252627282930313233 |
- package config
- import (
- "strings"
- log "github.com/Sirupsen/logrus"
- )
- type InitFunc func(*Config) error
- func RunInitFuncs(cfg *Config, initFuncs []InitFunc) error {
- for i, initFunc := range initFuncs {
- log.Debugf("[%d/%d] Starting", i+1, len(initFuncs))
- if err := initFunc(cfg); err != nil {
- log.Errorf("Failed [%d/%d] %d%%", i+1, len(initFuncs), ((i + 1) * 100 / len(initFuncs)))
- return err
- }
- log.Debugf("[%d/%d] Done %d%%", i+1, len(initFuncs), ((i + 1) * 100 / len(initFuncs)))
- }
- return nil
- }
- func FilterGlobalConfig(input []string) []string {
- result := make([]string, 0, len(input))
- for _, value := range input {
- if !strings.HasPrefix(value, "--rancher") {
- result = append(result, value)
- }
- }
- return result
- }
|