Пример #1
0
func readRancherCompose(relativePath string, newTemplate *model.Template) error {

	composeBytes, err := readFile(relativePath, "rancher-compose.yml")
	if err != nil {
		return err
	}

	catalogConfig, err := lookup.ParseCatalogConfig(*composeBytes)
	if err != nil {
		return err
	}

	newTemplate.Questions = catalogConfig.Questions
	newTemplate.Name = catalogConfig.Name
	newTemplate.Description = catalogConfig.Description
	newTemplate.Version = catalogConfig.Version
	newTemplate.MinimumRancherVersion = catalogConfig.MinimumRancherVersion
	newTemplate.Output = catalogConfig.Output
	newTemplate.Labels = catalogConfig.Labels
	binding, err := model.CreateBindings(relativePath)
	if err != nil {
		return err
	}
	newTemplate.Bindings = binding
	newTemplate.MaximumRancherVersion = catalogConfig.MaximumRancherVersion
	newTemplate.UpgradeFrom = catalogConfig.UpgradeFrom
	return nil
}