// readPlanDefinition parses a given config yaml file into the config instance
readPlanDefinition parses a given config yaml file into the config instance
// readPlanDefinition parses a given config yaml file into the config instance
func readPlanDefinition() (config model.Config, err error) {
	files, err := findConfigFiles()
	if err != nil {
		return config, err
	}
	log.Println("reading plans from %d config files", len(files))
	var plans = make(map[string]model.Plan)
	for _, file := range files {
		plansOfFile, err := ExtractPlans(file)
		if err != nil {
			return config, err
		}
		for name, plan := range plansOfFile {
			if _, ok := plans[name]; ok {
				return config, fmt.Errorf("the plan with the name \"%s\" has been declared more than once", name)
			}
			plans[name] = plan
		}
	}
	config.Plans = plans
	log.Printf("Found %d plans", len(config.Plans))
	return config, nil
}
func readPlanDefinition ( ) ( config model . Config , err error ) { files , err := findConfigFiles ( ) if err != nil { return config , err } log . Println ( " " , len ( files ) ) var plans = make ( map [ string ] model . Plan ) for _ , file := range files { plansOfFile , err := ExtractPlans ( file ) if err != nil { return config , err } for name , plan := range plansOfFile { if _ , ok := plans [ name ] ; ok { return config , fmt . Errorf ( " \" \" " , name ) } plans [ name ] = plan } } config . Plans = plans log . Printf ( " " , len ( config . Plans ) ) return config , nil }
readPlanDefinition parses a given config yaml file into the config instance
readPlanDefinition parses a given config yaml file into the config instance
// Get all yaml files from the execution directory. () // Check if a plan with this name already exists // Add plan