-
Notifications
You must be signed in to change notification settings - Fork 89
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
InterfaceMetric: Configure a static metric for an IPv4 Interface #472
Conversation
Thanks @cohdjn - will get onto the review tomorrow |
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.
Reviewed 8 of 8 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @cohdjn)
CHANGELOG.md, line 16 at r1 (raw file):
- NetIPInterface - Added `InterfaceMetric` parameter.
Can you add link to issue - e.g.
- Added `InterfaceMetric` parameter - fixes [Issue #473](https://github.com/PowerShell/xNetworking/issues/473).
source/DSCResources/DSC_NetIPInterface/DSC_NetIPInterface.psm1, line 433 at r1 (raw file):
[Parameter()] [System.UInt32] $InterfaceMetric
If InterfaceMetric
is specified, will AutomaticMetric
be automatically set to 'Disabled'? If that is the case, is the reverse true? My thinking here is that if I have an adapter that currently has InterfaceMetric
specified and AutomaticMetric
is set to 'Disabled' but the desired state should be AutomaticMetric
is 'Enabled' then how would this be set?
I'm wondering if we need to expose the AutomaticMetric
parameter as well? What do you think?
I added the issue link to the CHANGELOG.md. So here's the default state: Get-NetIPInterface | Select-Object ifIndex,InterfaceAlias,InterfaceMetric,AutomaticMetric
ifIndex InterfaceAlias InterfaceMetric AutomaticMetric
------- -------------- --------------- ---------------
4 Ethernet 15 Enabled
1 Loopback Pseudo-Interface 1 75 Enabled
4 Ethernet 15 Enabled
1 Loopback Pseudo-Interface 1 75 Enabled If I issue the following nonsense command, this is what happens: Set-NetIPInterface -InterfaceIndex 4 -AddressFamily IPv4 -AutomaticMetric Enabled -InterfaceMetric 20
Get-NetIPInterface | Select-Object ifIndex,InterfaceAlias,InterfaceMetric,AutomaticMetric
ifIndex InterfaceAlias InterfaceMetric AutomaticMetric
------- -------------- --------------- ---------------
4 Ethernet 15 Enabled
1 Loopback Pseudo-Interface 1 75 Enabled
4 Ethernet 20 Disabled
1 Loopback Pseudo-Interface 1 75 Enabled Notice I explicitly enabled I suppose there's 2 ways to go here. We could have the module throw() if there are conflicting settings which strikes me as pretty ugly. Or we could call out something in the documentation saying if you specify a value for
|
Hi @cohdjn - what I'm thinking though is that how would I set the state to The resource could assume that if There should always be a way to explicitly set the resource to any valid combination of values. However, only some of these combinations will be valid as you point out. So the questions I have:
|
Hey there @PlagueHO - I think we're missing each other on the NetIPInterface EthernetMetric
{
InterfaceAlias = 'Ethernet'
AddressFamily = 'IPv4'
AutomaticMetric = 'Disabled'
InterfaceMetric = 20
}
NetIPInterface Ethernet2Metric
{
InterfaceAlias = 'Ethernet 2'
AddressFamily = 'IPv4'
AutomaticMetric = 'Enabled'
InterfaceMetric = 20
} These resource definitions are functionally equivalent because PowerShell will essentially ignore |
Doh!!! Haha I'm sorry- you are right. I should have checked- just assumed I hadn't exposed it. So yep, I'm happy to just note the combination in the README.md for the resource. |
Awesome! Anything else you need from me at this point? |
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.
Nope - once you've added the entry to the README.md I'll merge. Thanks again!
Reviewed 1 of 1 files at r2.
Reviewable status: complete! all files reviewed, all discussions resolved
Which README.md do you want me to make the additions to? The main one at the top of the hierarchy or the one under |
The one under |
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.
Hi @cohdjn - can you check the push occurred? The README.md change hasn't showed up. And yes, I think you're right about #391.
Reviewable status: complete! all files reviewed, all discussions resolved
That's weird. The push didn't go through on my side. I just pushed it and it looks better now. |
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.
Reviewed 1 of 1 files at r3.
Reviewable status: complete! all files reviewed, all discussions resolved
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @cohdjn)
source/DSCResources/DSC_NetIPInterface/README.MD, line 7 at r3 (raw file):
## Known Issues - If you define a value for `InterfaceMetric`, the `AutomaticMetric` setting is ignored. PowerShell ignores `AutomaticMetric` when you use both arguments with the `Set-NetIPInterface` cmdlet.
Minor nit pick: Can you reduce line length to < 80 chars (around end of sentence) and remove double spaces?
Minor nit pick picked. :) |
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.
Reviewable status: 8 of 9 files reviewed, 1 unresolved discussion (waiting on @cohdjn and @PlagueHO)
source/DSCResources/DSC_NetIPInterface/README.MD, line 7 at r3 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Minor nit pick: Can you reduce line length to < 80 chars (around end of sentence) and remove double spaces?
Doh - seems one of the double spaces turned to tipple and the line is still wrapping 😁
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.
Reviewed 1 of 1 files at r4.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @cohdjn)
source/DSCResources/DSC_NetIPInterface/README.MD, line 9 at r4 (raw file):
- If you define a value for `InterfaceMetric`, the `AutomaticMetric` setting is ignored. PowerShell ignores `AutomaticMetric` when you use both arguments with the `Set-NetIPInterface` cmdlet.
Sorry- correction - it is just this like that is triple spaced :) I know it is such a nitpick 😢
It's all good! More nits picked! :) |
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.
Reviewed 1 of 1 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved
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.
Reviewable status: complete! all files reviewed, all discussions resolved
Pull Request (PR) description
Adds InterfaceMetric to NetIPInterface to statically configure a metric on an IPv4 interface. I need this for multi-homed computers to give preference to one interface over another.
This Pull Request (PR) fixes the following issues
Task list
Entry should say what was changed, and how that affects users (if applicable).
and comment-based help.
This change is