Esempio n. 1
0
func deployBefore(c *cli.Context) error {
	if c.String("service-id") == "" {
		return errors.New("Service-id is empty")
	}

	if c.String("tag") == "" {
		return errors.New("The Tag of the image is empty")
	}

	if c.String("namespace") == "" {
		return errors.New("Namespace is empty")
	}

	if c.Int64("memory") < 0 {
		return errors.New("Memory flag value should not be negative")
	}

	if c.Float64("cpu") < 0 {
		return errors.New("Cpu flag value should not be negative")
	}

	for _, file := range c.StringSlice("env-file") {
		if err := util.FileExists(file); err != nil {
			return errors.New(fmt.Sprintf("El archivo %s con variables de entorno no existe", file))
		}
	}

	if c.Float64("minimumHealthCapacity") < 0.0 || c.Float64("minimumHealthCapacity") > 1.0 {
		return errors.New("MinimumHealthCapacity flag value should be between 0.0 and 1.0")
	}

	if c.Float64("maximumOverCapacity") < 0.0 || c.Float64("maximumOverCapacity") > 1.0 {
		return errors.New("MaximumOverCapacity flag value should be between 0.0 and 1.0")
	}

	return nil
}