@@ -212,7 +212,7 @@ func Validate(y *limatype.LimaYAML, warn bool) error {
212212 errs = errors .Join (errs , fmt .Errorf ("field `provision[%d].permissions` must be an octal number: %w" , i , err ))
213213 }
214214 default :
215- if p .Script == "" && p .Mode != limatype .ProvisionModeAnsible {
215+ if ( p .Script == nil || * p . Script == "" ) && p .Mode != limatype .ProvisionModeAnsible {
216216 errs = errors .Join (errs , fmt .Errorf ("field `provision[%d].script` must not be empty" , i ))
217217 }
218218 if p .Content != nil {
@@ -238,7 +238,7 @@ func Validate(y *limatype.LimaYAML, warn bool) error {
238238 if p .Mode != limatype .ProvisionModeAnsible {
239239 errs = errors .Join (errs , fmt .Errorf ("field `provision[%d].playbook can only be set when mode is %q" , i , limatype .ProvisionModeAnsible ))
240240 }
241- if p .Script != "" {
241+ if p .Script != nil && * p . Script != "" {
242242 errs = errors .Join (errs , fmt .Errorf ("field `provision[%d].script must be empty if playbook is set" , i ))
243243 }
244244 playbook := p .Playbook
@@ -247,8 +247,10 @@ func Validate(y *limatype.LimaYAML, warn bool) error {
247247 }
248248 logrus .Warnf ("provision mode %q is deprecated, use `ansible-playbook %q` instead" , limatype .ProvisionModeAnsible , playbook )
249249 }
250- if strings .Contains (p .Script , "LIMA_CIDATA" ) {
251- logrus .Warn ("provisioning scripts should not reference the LIMA_CIDATA variables" )
250+ if p .Script != nil {
251+ if strings .Contains (* p .Script , "LIMA_CIDATA" ) {
252+ logrus .Warn ("provisioning scripts should not reference the LIMA_CIDATA variables" )
253+ }
252254 }
253255 }
254256 needsContainerdArchives := (y .Containerd .User != nil && * y .Containerd .User ) || (y .Containerd .System != nil && * y .Containerd .System )
@@ -521,7 +523,7 @@ func validateParamIsUsed(y *limatype.LimaYAML) error {
521523 }
522524 keyIsUsed := false
523525 for _ , p := range y .Provision {
524- for _ , ptr := range []* string {& p .Script , p .Content , p .Expression , p .Owner , p .Path , p .Permissions } {
526+ for _ , ptr := range []* string {p .Script , p .Content , p .Expression , p .Owner , p .Path , p .Permissions } {
525527 if ptr != nil && re .MatchString (* ptr ) {
526528 keyIsUsed = true
527529 break
0 commit comments