Skip to content

Commit d53383d

Browse files
persist connector logging update for CHAP support in CSI (#9)
* fix: remove logging of full Connector struct as it may contain sensitive information * fix: Use reference to connector in call to Connect Co-authored-by: Joe Skazinski <joseph.skazinski@seagate.com> Signed-off-by: David-T-White <64927637+David-T-White@users.noreply.github.com> --------- Signed-off-by: David-T-White <64927637+David-T-White@users.noreply.github.com> Co-authored-by: Joe Skazinski <joseph.skazinski@seagate.com>
1 parent bddc22f commit d53383d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func main() {
5555

5656
// Now we can just issue a connection request using our Connector
5757
// A succesful connection will include the device path to access our iscsi volume
58-
path, err := iscsi.Connect(c)
58+
path, err := iscsi.Connect(&c)
5959
if err != nil {
6060
log.Printf("Error returned from iscsi.Connect: %s", err.Error())
6161
os.Exit(1)

iscsi/iscsi.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type TargetInfo struct {
4545
Port string `json:"port"`
4646
}
4747

48-
//Connector provides a struct to hold all of the needed parameters to make our iscsi connection
48+
// Connector provides a struct to hold all of the needed parameters to make our iscsi connection
4949
type Connector struct {
5050
VolumeName string `json:"volume_name"`
5151
Targets []TargetInfo `json:"targets"`
@@ -385,7 +385,7 @@ func Connect(c *Connector) (string, error) {
385385
return "", err
386386
}
387387

388-
//Disconnect performs a disconnect operation on a volume
388+
// Disconnect performs a disconnect operation on a volume
389389
func Disconnect(tgtIqn string, portals []string) error {
390390
err := Logout(tgtIqn, portals)
391391
if err != nil {
@@ -480,7 +480,7 @@ func PersistConnector(c *Connector, filePath string) error {
480480
}
481481
defer f.Close()
482482
encoder := json.NewEncoder(f)
483-
debug.Printf("ConnectorFromFile (write): file=%v, c=%+v\n", filePath, c)
483+
debug.Printf("Connector Persistence File (write): file=%s\n", filePath)
484484
if err = encoder.Encode(c); err != nil {
485485
debug.Printf("ERROR: error encoding connector: %v\n", err)
486486
return fmt.Errorf("error encoding connector: %v", err)
@@ -503,7 +503,7 @@ func GetConnectorFromFile(filePath string) (*Connector, error) {
503503
return &Connector{}, err
504504
}
505505

506-
debug.Printf("ConnectorFromFile (read): file=%s, %+v\n", filePath, data)
506+
debug.Printf("ConnectorFromFile (read): file=%s\n", filePath)
507507

508508
return &data, nil
509509

0 commit comments

Comments
 (0)