Exemplo n.º 1
0
func LoadConfig() (*CloudConfig, error) {
	cfg, err := ChainCfgFuncs(NewConfig(),
		readFilesAndMetadata,
		readCmdline,
		amendNils)
	if err != nil {
		log.WithFields(log.Fields{"cfg": cfg, "err": err}).Error("Failed to load config")
		return nil, err
	}

	log.Debug("Merging cloud-config from meta-data and user-data")
	cfg = mergeMetadata(cfg, readMetadata())

	if cfg.Rancher.Debug {
		log.SetLevel(log.DebugLevel)
		if !util.Contains(cfg.Rancher.Docker.Args, "-D") {
			cfg.Rancher.Docker.Args = append(cfg.Rancher.Docker.Args, "-D")
		}
		if !util.Contains(cfg.Rancher.SystemDocker.Args, "-D") {
			cfg.Rancher.SystemDocker.Args = append(cfg.Rancher.SystemDocker.Args, "-D")
		}
	}

	return cfg, nil
}
Exemplo n.º 2
0
func LoadConfig() (*Config, error) {
	cfg := NewConfig()
	if err := cfg.Reload(); err != nil {
		return nil, err
	}

	if cfg.Debug {
		log.SetLevel(log.DebugLevel)
		if !util.Contains(cfg.UserDocker.Args, "-D") {
			cfg.UserDocker.Args = append(cfg.UserDocker.Args, "-D")
		}
		if !util.Contains(cfg.SystemDocker.Args, "-D") {
			cfg.SystemDocker.Args = append(cfg.SystemDocker.Args, "-D")
		}
	}

	return cfg, nil
}
Exemplo n.º 3
0
Arquivo: config.go Projeto: rowhit/os
func LoadConfig() (*CloudConfig, error) {
	cfg := NewConfig()
	if err := cfg.Reload(); err != nil {
		log.WithFields(log.Fields{"cfg": cfg, "err": err}).Error("Failed to reload config")
		return nil, err
	}

	if cfg.Rancher.Debug {
		log.SetLevel(log.DebugLevel)
		if !util.Contains(cfg.Rancher.UserDocker.Args, "-D") {
			cfg.Rancher.UserDocker.Args = append(cfg.Rancher.UserDocker.Args, "-D")
		}
		if !util.Contains(cfg.Rancher.SystemDocker.Args, "-D") {
			cfg.Rancher.SystemDocker.Args = append(cfg.Rancher.SystemDocker.Args, "-D")
		}
	}

	return cfg, nil
}
Exemplo n.º 4
0
func (c *Container) hasLink(link string) bool {
	return util.Contains(c.ContainerCfg.Service.Links.Slice(), link)
}