(profile interface{})
| 689 | } |
| 690 | |
| 691 | func copyForValidation(profile interface{}) (*latest.ProfileConfig, error) { |
| 692 | profileMap, ok := profile.(map[string]interface{}) |
| 693 | if !ok { |
| 694 | return nil, fmt.Errorf("error loading profiles: invalid format") |
| 695 | } |
| 696 | |
| 697 | clone := map[string]interface{}{ |
| 698 | "name": profileMap["name"], |
| 699 | "parent": profileMap["parent"], |
| 700 | "parents": profileMap["parents"], |
| 701 | "patches": profileMap["patches"], |
| 702 | "activation": profileMap["activation"], |
| 703 | } |
| 704 | |
| 705 | o, err := yaml.Marshal(clone) |
| 706 | if err != nil { |
| 707 | return nil, err |
| 708 | } |
| 709 | |
| 710 | profileConfig := &latest.ProfileConfig{} |
| 711 | err = yamlutil.UnmarshalStrict(o, profileConfig) |
| 712 | if err != nil { |
| 713 | return nil, err |
| 714 | } |
| 715 | |
| 716 | return profileConfig, nil |
| 717 | } |
no test coverage detected