Ejemplo n.º 1
0
func autoformat(cfg *config.CloudConfig) (*config.CloudConfig, error) {
	if len(cfg.Rancher.State.Autoformat) == 0 || util.ResolveDevice(cfg.Rancher.State.Dev) != "" {
		return cfg, nil
	}
	AUTOFORMAT := "AUTOFORMAT=" + strings.Join(cfg.Rancher.State.Autoformat, " ")
	FORMATZERO := "FORMATZERO=" + fmt.Sprint(cfg.Rancher.State.FormatZero)
	t := *cfg
	t.Rancher.Autoformat["autoformat"].Environment = project.NewMaporEqualSlice([]string{AUTOFORMAT, FORMATZERO})
	log.Info("Running Autoformat services")
	_, err := compose.RunServiceSet("autoformat", &t, t.Rancher.Autoformat)
	return &t, err
}
Ejemplo n.º 2
0
func mountConfigured(display, dev, fsType, target string) error {
	var err error

	if dev == "" {
		return nil
	}

	dev = util.ResolveDevice(dev)
	if dev == "" {
		return fmt.Errorf("Could not resolve device %q", dev)
	}
	if fsType == "auto" {
		fsType, err = util.GetFsType(dev)
	}

	if err != nil {
		return err
	}

	log.Debugf("FsType has been set to %s", fsType)
	log.Infof("Mounting %s device %s to %s", display, dev, target)
	return util.Mount(dev, target, fsType, "")
}
Ejemplo n.º 3
0
Archivo: init.go Proyecto: Jdesk/os
func mountState(cfg *config.CloudConfig) error {
	var err error

	if cfg.Rancher.State.Dev == "" {
		return nil
	}

	dev := util.ResolveDevice(cfg.Rancher.State.Dev)
	if dev == "" {
		return fmt.Errorf("Could not resolve device %q", cfg.Rancher.State.Dev)
	}
	fsType := cfg.Rancher.State.FsType
	if fsType == "auto" {
		fsType, err = util.GetFsType(dev)
	}

	if err != nil {
		return err
	}

	log.Debugf("FsType has been set to %s", fsType)
	log.Infof("Mounting state device %s to %s", dev, STATE)
	return util.Mount(dev, STATE, fsType, "")
}
Ejemplo n.º 4
0
func devAction(c *cli.Context) {
	if len(c.Args()) > 0 {
		fmt.Println(util.ResolveDevice(c.Args()[0]))
	}
}