-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: skip setting SdnRemoteArpMacAddress when hns is not enabled #2315
Conversation
9323adc
to
6b5cc8d
Compare
6b5cc8d
to
d85d77d
Compare
platform/os_windows.go
Outdated
@@ -68,6 +68,10 @@ const ( | |||
SetSdnRemoteArpMacAddressCommand = "Set-ItemProperty " + | |||
"-Path HKLM:\\SYSTEM\\CurrentControlSet\\Services\\hns\\State -Name SDNRemoteArpMacAddress -Value \"12-34-56-78-9a-bc\"" | |||
|
|||
// Command to check if system have hns path or not | |||
CheckIfHNSPathExistsCommand = "Test-Path " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add HNSState in the var for correctness - CheckIfHNSStatePathExistsCommand
platform/os_windows.go
Outdated
func SetSdnRemoteArpMacAddress(execClient ExecClient) error { | ||
exists, err := execClient.ExecutePowershellCommand(CheckIfHNSPathExistsCommand) | ||
if err != nil { | ||
errMsg := fmt.Sprintf("Failed to check the existent of hns path due to error %s", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; HNS State path
platform/os_windows_test.go
Outdated
mockExecClient := NewMockExecClient(false) | ||
// testing skip setting SdnRemoteArpMacAddress when hns not enabled | ||
mockExecClient.SetPowershellCommandResponder(func(_ string) (string, error) { | ||
return "false", nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: return False and True instead of false / true to reflect the actual values returned ( which are case sensitive which will also test the equalFold )
Signed-off-by: ZetaoZhuang <106119232+ZetaoZhuang@users.noreply.github.com>
Signed-off-by: ZetaoZhuang <106119232+ZetaoZhuang@users.noreply.github.com>
Signed-off-by: ZetaoZhuang <106119232+ZetaoZhuang@users.noreply.github.com>
Signed-off-by: ZetaoZhuang <106119232+ZetaoZhuang@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good overall
Signed-off-by: ZetaoZhuang <106119232+ZetaoZhuang@users.noreply.github.com>
Signed-off-by: ZetaoZhuang <106119232+ZetaoZhuang@users.noreply.github.com>
Reason for Change:
fix: skip setting SdnRemoteArpMacAddress when hns is not enabled
Issue Fixed:
Requirements:
Notes: