2020-03-27 19:45:01 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package ansible
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2020-11-19 14:54:31 -05:00
|
|
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
2020-03-27 19:45:01 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type provisionLogicTracker struct {
|
|
|
|
setupAdapterCalled bool
|
|
|
|
executeAnsibleCalled bool
|
|
|
|
happyPath bool
|
|
|
|
}
|
|
|
|
|
2020-11-19 18:10:00 -05:00
|
|
|
func (l *provisionLogicTracker) setupAdapter(ui packersdk.Ui, comm packersdk.Communicator) (string, error) {
|
2020-03-27 19:45:01 -04:00
|
|
|
l.setupAdapterCalled = true
|
|
|
|
if l.happyPath {
|
|
|
|
return "fakeKeyString", nil
|
|
|
|
}
|
|
|
|
return "", fmt.Errorf("chose sadpath")
|
|
|
|
}
|
|
|
|
|
2020-11-19 18:10:00 -05:00
|
|
|
func (l *provisionLogicTracker) executeAnsible(ui packersdk.Ui, comm packersdk.Communicator, privKeyFile string) error {
|
2020-03-27 19:45:01 -04:00
|
|
|
l.executeAnsibleCalled = true
|
|
|
|
if l.happyPath {
|
|
|
|
return fmt.Errorf("Chose sadpath")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|