func exec()

in pkg/controller/broker/broker_controller.go [381:399]


func exec(cmdOpts []string, podName string, k8s *tool.K8sClient, namespace string) (string, error) {
	log.Info("On pod " + podName + ", command being run: " + strings.Join(cmdOpts, " "))
	container := cons.BrokerContainerName
	outputBytes, stderrBytes, err := k8s.Exec(namespace, podName, container, cmdOpts, nil)
	stderr := stderrBytes.String()
	output := outputBytes.String()

	if stderrBytes != nil {
		log.Info("STDERR: " + stderr)
	}
	log.Info("output: " + output)

	if err != nil {
		log.Error(err, "Error occurred while running command: "+strings.Join(cmdOpts, " "))
		return output, err
	}

	return output, nil
}