Esempio n. 1
0
func LoadService(p *project.Project, cfg *config.CloudConfig, useNetwork bool, service string) error {
	bytes, err := network.LoadServiceResource(service, useNetwork, cfg)
	if err != nil {
		return err
	}

	m := map[interface{}]interface{}{}
	if err = yaml.Unmarshal(bytes, &m); err != nil {
		return fmt.Errorf("Failed to parse YAML configuration for %s: %v", service, err)
	}

	m = adjustContainerNames(m)

	bytes, err = yaml.Marshal(m)
	if err != nil {
		return fmt.Errorf("Failed to marshal YAML configuration for %s: %v", service, err)
	}

	if err = p.Load(bytes); err != nil {
		return fmt.Errorf("Failed to load %s: %v", service, err)
	}

	return nil
}