Closed timboven closed 3 years ago
Hello, any plans to support puppet > 6 ?
You can use the "puppet6" branch. I'll keep it in sync for now until I have time to look at correct implementation to support both.
I haven't tested this code to check for edge cases, but I believe something like the following will get you approximately the behavior of choosing the right branch based on what version of Puppet is being used:
def initialize(url, options = {})
if Gem::Version.new(Puppet.version) >= Gem::Version.new("6.0.0")
should_proceed = true
else
@autoloader = Puppet::Util::Autoload.new(
self,
'puppet/util/network_device/transport'
)
should_proceed = @autoloader.load('mikrotik', 'production')
end
if should_proceed
@transport = Puppet::Util::NetworkDevice::Transport::Mikrotik.new(url, options[:debug])
end
end
I have added this code for backwards-compatibility, but not tested on Puppet 5.
I tried to use this code with a recent version of puppet but couldn't get it working (with the code as is). My Ruby is very limited but looks like something changed to the API related to the autoloader used in device.rb
I commented all the code related to the autoloader and let it just create the transport:
With this modified version I was able to use this code with a recent version of puppet.