INNER CODE UNIT · Go

testAnsiblePlaybook

backube/volsync · custom-scorecard-tests/main.go:200

func testAnsiblePlaybook(ansiblePlaybookTestName string) scapiv1alpha3.TestStatus {
	r := scapiv1alpha3.TestResult{}
	r.Name = ansiblePlaybookTestName
	r.State = scapiv1alpha3.PassState
	r.Errors = make([]string, 0)
	r.Suggestions = make([]string, 0)

	output, err := shellout(fmt.Sprintf("cd test-e2e && pipenv run ansible-playbook %s", ansiblePlaybookTestName))

	r.Log = output

	if err != nil {
		r.State = scapiv1alpha3.FailState

		// Playbook run failed, run the playbook to dump logs
		dumpLogsOutput, _ := shellout("cd test-e2e && pipenv run ansible-playbook dump_logs.yml")
		r.Log = r.Log + "\n\n==DUMPLOGS==\n" + dumpLogsOutput
	} else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…