Use IPGlobalProperties on all platforms#9530
Merged
adityapatwardhan merged 2 commits intoPowerShell:masterfrom May 8, 2019
Merged
Use IPGlobalProperties on all platforms#9530adityapatwardhan merged 2 commits intoPowerShell:masterfrom
adityapatwardhan merged 2 commits intoPowerShell:masterfrom
Conversation
Collaborator
Author
|
It seems it is impossible to create useful test for the API. @adityapatwardhan Could you please check Ubuntu container? |
Member
|
The change looks good to me. I verified the code on an Unbuntu 18.04 container: PowerShell 6.2.0
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /> cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
PS /> [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties() | sv x
PS /> $x
DhcpScopeName :
DomainName : (none)
HostName : 7af9466760d8
IsWinsProxy :
NodeType : Unknown
PS /> |
Member
|
I also agree adding a test for this is useless. |
adityapatwardhan
approved these changes
May 8, 2019
Member
|
@iSazonov Thank you for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
On Windows we use System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties to get computer name and domain name. The API was ported so we can remove P/Invokes for Unix-es.
On Unix CoreFX (then and then) calls GLibc getdomainname() which returns "(none)" if a domain name is not set by setdomainname(). (See https://access.redhat.com/solutions/352963) So we ignore the value.
PR Context
Related #9526.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.