@@ -608,11 +608,6 @@ func getPolicyTypes(p *v1.Policy) []v1.CraftingSchema_Material_MaterialType {
608608 return policyTypes
609609}
610610
611- // injectBoilerplateIfNeeded automatically injects common policy boilerplate
612- func injectBoilerplateIfNeeded (policySource []byte , policyName string ) ([]byte , error ) {
613- return rego .InjectBoilerplate (policySource , policyName )
614- }
615-
616611// LoadPolicyScriptsFromSpec loads all policy script that matches a given material type. It matches if:
617612// * the policy kind is unspecified, meaning that it was forced by name selector
618613// * the policy kind is specified, and it's equal to the material type
@@ -626,7 +621,7 @@ func LoadPolicyScriptsFromSpec(policy *v1.Policy, kind v1.CraftingSchema_Materia
626621 }
627622
628623 // Inject boilerplate if needed
629- script , err = injectBoilerplateIfNeeded (script , policy .GetMetadata ().GetName ())
624+ script , err = rego . InjectBoilerplate (script , policy .GetMetadata ().GetName ())
630625 if err != nil {
631626 return nil , fmt .Errorf ("failed to inject boilerplate: %w" , err )
632627 }
@@ -643,7 +638,7 @@ func LoadPolicyScriptsFromSpec(policy *v1.Policy, kind v1.CraftingSchema_Materia
643638 }
644639
645640 // Inject boilerplate if needed
646- script , err = injectBoilerplateIfNeeded (script , policy .GetMetadata ().GetName ())
641+ script , err = rego . InjectBoilerplate (script , policy .GetMetadata ().GetName ())
647642 if err != nil {
648643 return nil , fmt .Errorf ("failed to inject boilerplate: %w" , err )
649644 }
0 commit comments