Exemplo n.º 1
0
func (tx *Transaction) exec(cmd string, args ...string) (string, error) {
	if tx.err != nil {
		return "", tx.err
	}

	cmdpath, err := exec.LookPath(cmd)
	if err != nil {
		tx.err = fmt.Errorf("OVS is not installed")
		return "", tx.err
	}

	var output string
	output, tx.err = exec.Exec(cmdpath, args...)
	return output, tx.err
}
Exemplo n.º 2
0
func (tx *Transaction) exec(args []string) (string, error) {
	if tx.err != nil {
		return "", tx.err
	}

	ipcmdPath, err := exec.LookPath("ip")
	if err != nil {
		tx.err = fmt.Errorf("ip is not installed")
		return "", tx.err
	}

	var output string
	output, tx.err = exec.Exec(ipcmdPath, args...)
	return output, tx.err
}