INNER CODE UNIT · Go

shellQuote

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

func shellQuote(value string) string {
	return "'" + strings.ReplaceAll(value, "'", "'\"'\"'") + "'"
}

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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…