Set provider if available

This commit is contained in:
sophia 2022-09-06 12:53:28 -04:00
parent b8a644793a
commit f26ff28ad4

View File

@ -456,6 +456,7 @@ func (v *Vagrantfile) Target(
Project: v.targetSource, Project: v.targetSource,
}, },
), ),
WithProvider(provider),
} }
var vf *Vagrantfile var vf *Vagrantfile
@ -468,12 +469,15 @@ func (v *Vagrantfile) Target(
if err != nil { if err != nil {
return nil, err return nil, err
} }
rawTarget := target.(*Target)
if provider != "" {
rawTarget.target.Provider = provider
}
// Since the target config gives us a Vagrantfile which is // Since the target config gives us a Vagrantfile which is
// attached to the project, we need to clone it and attach // attached to the project, we need to clone it and attach
// it to the target we loaded // it to the target we loaded
if vf != nil { if vf != nil {
rawTarget := target.(*Target)
tvf := vf.clone(name) tvf := vf.clone(name)
if err = tvf.Init(); err != nil { if err = tvf.Init(); err != nil {