Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ ipconfig {'Local Area Connection':
ipaddress => ["10.10.10.100"],
subnetmask => ["255.255.255.0"],
defaultgateway => ["10.10.10.1"],
gwcostmetric => 256,
gwcostmetric => 256,
ipconnectionmetric => 1,
dnsregister => true,
fulldnsregister => true,
netbios => 'enabled',
Expand Down
15 changes: 14 additions & 1 deletion lib/puppet/provider/ipconfig/ipconfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def backoff(upto)
return result
end

def getreg(guid,keyname)
def getreg(guid,keyname)
require 'win32/registry'
keypath = "SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces\\" + guid
reg_type = Win32::Registry::KEY_READ | WOW64_64
Expand Down Expand Up @@ -134,6 +134,19 @@ def gwcostmetric= newvalue
self.defaultgateway= @resource[:defaultgateway]
end

def ipconnectionmetric
enum_netconn do |netconnectionid|
metric = netconnectionid.ipconnectionmetric.to_s
return metric
end
end

def ipconnectionmetric= newvalue
enum_netconn do |netconnectionid|
setipconnectionmetric(netconnectionid,@resource[:ipconnectionmetric])
end
end

def dns
dnssvrs ||= Array.new
enum_netconn do |netconnectionid|
Expand Down
7 changes: 7 additions & 0 deletions lib/puppet/provider/winnetwork.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ def setgateways(adapter,gateways_hash={})
oOutParam = adapter.ExecMethod_("SetGateways", oInParam)
end

def setipconnectionmetric(adapter,metric)
oMethod = adapter.Methods_("SetIPConnectionMetric")
oInParam = oMethod.InParameters.SpawnInstance_()
oInParam.IPConnectionMetric = metric
oOutParam = adapter.ExecMethod_("SetIPConnectionMetric", oInParam)
end

def setdnsserversearchorder(adapter,searchorder)
oMethod = adapter.Methods_("SetDNSServerSearchOrder")
oInParam = oMethod.InParameters.SpawnInstance_()
Expand Down
4 changes: 4 additions & 0 deletions lib/puppet/type/ipconfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def valid_v4?(addr)
defaultto 256
end

newproperty(:ipconnectionmetric) do
desc "The IP Connection Metric for the Adapter"
end

newproperty(:dnsdomainsuffixsearchorder, :array_matching => :all) do
desc 'Append these DNS Suffixes'
end
Expand Down