@@ -3,9 +3,7 @@ package iscsi
3
3
import (
4
4
"bytes"
5
5
"fmt"
6
- "os/exec"
7
6
"strings"
8
- "syscall"
9
7
)
10
8
11
9
// Secrets provides optional iscsi security credentials (CHAP settings)
@@ -60,57 +58,18 @@ func iscsiCmd(args ...string) (string, error) {
60
58
}
61
59
}
62
60
63
- iscsiadmDebug (args , string (stdout .Bytes ()), iscsiadmError )
61
+ iscsiadmDebug (string (stdout .Bytes ()), iscsiadmError )
64
62
return string (stdout .Bytes ()), iscsiadmError
65
63
}
66
64
67
- func iscsiadmDebug (args [] string , output string , cmdError error ) {
65
+ func iscsiadmDebug (output string , cmdError error ) {
68
66
debugOutput := strings .Replace (output , "\n " , "\\ n" , - 1 )
69
- debug .Printf ("Output of iscsiadm command: {{cmd: iscsiadm %s}, { output: %s}" , args , debugOutput )
67
+ debug .Printf ("Output of iscsiadm command: {output: %s}" , debugOutput )
70
68
if cmdError != nil {
71
- debug .Printf ("Error message returned from issiadm command: %s" , cmdError .Error ())
69
+ debug .Printf ("Error message returned from iscsiadm command: %s" , cmdError .Error ())
72
70
}
73
71
}
74
72
75
- func iscsiCmdHide (args ... string ) (string , error ) {
76
- debug .Printf ("Execute iscsiadm %s" , args )
77
- var waitStatus syscall.WaitStatus
78
- var iscsiHelper = "iscsiadm"
79
- eStat := 0
80
- out := & bytes.Buffer {}
81
- cmdErr := & bytes.Buffer {}
82
-
83
- c := execCommand (iscsiHelper , args ... )
84
- c .Stdout = out
85
- c .Stderr = cmdErr
86
- iscsiadmErr := CmdError {}
87
-
88
- if err := c .Run (); err != nil {
89
- if exitError , ok := err .(* exec.ExitError ); ok {
90
- waitStatus = exitError .Sys ().(syscall.WaitStatus )
91
- eStat = waitStatus .ExitStatus ()
92
- }
93
- } else {
94
- waitStatus = c .ProcessState .Sys ().(syscall.WaitStatus )
95
- eStat = waitStatus .ExitStatus ()
96
- }
97
- if eStat != 0 || string (cmdErr .Bytes ()) != "" {
98
- iscsiadmErr = CmdError {
99
- StdErr : string (cmdErr .Bytes ()),
100
- ExitCode : eStat ,
101
- CMD : iscsiHelper + " " + strings .Join (args , " " ),
102
- }
103
- }
104
- if & iscsiadmErr != nil {
105
- debug .Printf ("FUCK: %v\n " , & iscsiadmErr )
106
- }
107
- debugOutput := strings .Replace (string (out .Bytes ()), "\n " , "\\ n " , - 1 )
108
- debugStderr := strings .Replace (string (cmdErr .Bytes ()), "\n " , "\\ n " , - 1 )
109
-
110
- debug .Printf ("Response from iscsiadm, {{output: %s}, {stderr: %s}, {exit-code: %d}}" , debugOutput , debugStderr , eStat )
111
- return string (out .Bytes ()), & iscsiadmErr
112
- }
113
-
114
73
// ListInterfaces returns a list of all iscsi interfaces configured on the node
115
74
/// along with the raw output in Response.StdOut we add the convenience of
116
75
// returning a list of entries found
0 commit comments