fix linting errors

pull/9753/head
Jituri, Pranav 2020-12-15 18:25:10 +05:30
parent ce17200bd8
commit a8463f3453
No known key found for this signature in database
GPG Key ID: 3D6729F63C792B4C
1 changed files with 4 additions and 4 deletions

View File

@ -17,10 +17,10 @@ limitations under the License.
package kic
import (
"context"
"fmt"
"net"
"os/exec"
"context"
"runtime"
"strconv"
"strings"
@ -215,20 +215,20 @@ func (d *Driver) prepareSSH() error {
klog.Infof("ensuring only current user has permissions to key file located at : %s...", keyPath)
// Get the SID of the current user
currentUserSidCmd := exec.CommandContext(ctx, path, "-NoProfile","-NonInteractive","([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value")
currentUserSidCmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value")
currentUserSidOut, currentUserSidErr := currentUserSidCmd.CombinedOutput()
if currentUserSidErr != nil {
klog.Warningf("unable to determine current user's SID. minikube tunnel may not work.")
} else {
icaclsArguments := fmt.Sprintf(`"%s" /grant:r *%s:F /inheritancelevel:r`, keyPath, strings.TrimSpace(string(currentUserSidOut)))
icaclsCmd := exec.CommandContext(ctx, path, "-NoProfile","-NonInteractive","icacls.exe", icaclsArguments)
icaclsCmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "icacls.exe", icaclsArguments)
icaclsCmdOut, icaclsCmdErr := icaclsCmd.CombinedOutput()
if icaclsCmdErr != nil {
return errors.Wrap(icaclsCmdErr, "unable to execute icacls to set permissions")
}
if !strings.Contains(string(icaclsCmdOut),"Successfully processed 1 files; Failed processing 0 files") {
if !strings.Contains(string(icaclsCmdOut), "Successfully processed 1 files; Failed processing 0 files") {
klog.Errorf("icacls failed applying permissions - err - [%s], output - [%s]", icaclsCmdErr, strings.TrimSpace(string(icaclsCmdOut)))
}
}