Skip to content

Commit f3b32bc

Browse files
committed
(FM-7701) Support device providers when using Transport Wrapper
1 parent f052a62 commit f3b32bc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/puppet/resource_api.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def register_type(definition)
4040
# Keeps a copy of the provider around. Weird naming to avoid clashes with puppet's own `provider` member
4141
define_singleton_method(:my_provider) do
4242
@my_provider ||= Hash.new { |hash, key| hash[key] = Puppet::ResourceApi.load_provider(definition[:name]).new }
43-
@my_provider[Puppet::Util::NetworkDevice.current.class]
43+
44+
if Puppet::Util::NetworkDevice.current.is_a? Puppet::ResourceApi::Transport::Wrapper
45+
@my_provider[Puppet::Util::NetworkDevice.current.transport.class]
46+
else
47+
@my_provider[Puppet::Util::NetworkDevice.current.class]
48+
end
4449
end
4550

4651
# make the provider available in the instance's namespace
@@ -414,7 +419,11 @@ def load_provider(type_name)
414419
nil
415420
else
416421
# extract the device type from the currently loaded device's class
417-
Puppet::Util::NetworkDevice.current.class.name.split('::')[-2].downcase
422+
if Puppet::Util::NetworkDevice.current.is_a? Puppet::ResourceApi::Transport::Wrapper
423+
Puppet::Util::NetworkDevice.current.schema.name
424+
else
425+
Puppet::Util::NetworkDevice.current.class.name.split('::')[-2].downcase
426+
end
418427
end
419428
device_class_name = class_name_from_type_name(device_name)
420429

0 commit comments

Comments
 (0)