(p *v1.Policy)
| 971 | } |
| 972 | |
| 973 | func getPolicyTypes(p *v1.Policy) []v1.CraftingSchema_Material_MaterialType { |
| 974 | policyTypes := make([]v1.CraftingSchema_Material_MaterialType, 0) |
| 975 | v1Type := p.GetSpec().GetType() |
| 976 | if v1Type != v1.CraftingSchema_Material_MATERIAL_TYPE_UNSPECIFIED { |
| 977 | policyTypes = append(policyTypes, v1Type) |
| 978 | } else { |
| 979 | for _, branch := range p.GetSpec().GetPolicies() { |
| 980 | if branch.GetKind() != v1.CraftingSchema_Material_MATERIAL_TYPE_UNSPECIFIED { |
| 981 | policyTypes = append(policyTypes, branch.GetKind()) |
| 982 | } |
| 983 | } |
| 984 | } |
| 985 | return policyTypes |
| 986 | } |
| 987 | |
| 988 | // LoadPolicyScriptsFromSpec loads all policy script that matches a given material type. It matches if: |
| 989 | // * the policy kind is unspecified, meaning that it was forced by name selector |
no test coverage detected