예제 #1
0
func (c *Context) unmarshalBytes(composeBytes, bytes []byte) error {
	rawServiceMap := project.RawServiceMap{}
	if composeBytes != nil {
		if err := yaml.Unmarshal(composeBytes, &rawServiceMap); err != nil {
			return err
		}

		for key := range rawServiceMap {
			delete(rawServiceMap[key], "hostname")
		}
	}
	if bytes != nil {
		if err := yaml.Unmarshal(bytes, &rawServiceMap); err != nil {
			return err
		}
	}
	if err := project.Interpolate(c.EnvironmentLookup, &rawServiceMap); err != nil {
		return err
	}
	if err := utils.Convert(rawServiceMap, &c.RancherConfig); err != nil {
		return err
	}
	for _, v := range c.RancherConfig {
		rUtils.RemoveInterfaceKeys(v.Metadata)
	}
	return nil
}
예제 #2
0
func (c *Context) unmarshalBytes(bytes []byte) error {
	rawServiceMap := project.RawServiceMap{}
	if err := yaml.Unmarshal(bytes, &rawServiceMap); err != nil {
		return err
	}
	if err := project.Interpolate(c.EnvironmentLookup, &rawServiceMap); err != nil {
		return err
	}
	return utils.Convert(rawServiceMap, &c.RancherConfig)
}