Skip to content

Commit

Permalink
Delete Public SSH Key tmp file after calculating fingerprint (#1855)
Browse files Browse the repository at this point in the history
* Delete public key tmp file after calculating fingerprint

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>

* Move line

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>

* Remove defer statement

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>

* Readd defer statement and move remove

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>

* Delete space

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>
  • Loading branch information
dnmgns authored and lunny committed Jun 8, 2017
1 parent 65cf6cc commit ff74241
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions models/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ func calcFingerprint(publicKeyContent string) (string, error) {
if err != nil {
return "", err
}
defer os.Remove(tmpPath)
stdout, stderr, err := process.GetManager().Exec("AddPublicKey", "ssh-keygen", "-lf", tmpPath)
if err != nil {
return "", fmt.Errorf("'ssh-keygen -lf %s' failed with error '%s': %s", tmpPath, err, stderr)
Expand Down

0 comments on commit ff74241

Please sign in to comment.