Пример #1
0
func ParseFromV1(rawConfig []byte) (types.Config, error) {
	config, err := v1.Parse(rawConfig)
	if err != nil {
		return types.Config{}, err
	}

	return TranslateFromV1(config)
}
Пример #2
0
// parseToV1 parses raw JSON or YAML in Ignition v1 format and returns the
// Ignition v1 Config struct.
func parseToV1(data []byte) (cfg ignitionV1Types.Config, err error) {
	// parse JSON v1 to Ignition
	cfg, err = ignitionV1.Parse(data)
	if err == nil {
		return cfg, nil
	}
	// unmarshal YAML v1 to Ignition
	err = yaml.Unmarshal(data, &cfg)
	return cfg, err
}