Skip to content

Commit

Permalink
Merge pull request #253 from DavidS/FM-8081-pdk-new-transport-shim
Browse files Browse the repository at this point in the history
(FM-8081) Add DeviceShim template too
  • Loading branch information
scotje authored May 30, 2019
2 parents b1f9d3a + f1eabfe commit f9d066a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions object_templates/transport_device.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'puppet/resource_api/transport/wrapper'

# Initialize the NetworkDevice module if necessary
module Puppet::Util::NetworkDevice; end

# The <%= name.capitalize %> module only contains the Device class to bridge from puppet's internals to the Transport.
# All the heavy lifting is done bye the Puppet::ResourceApi::Transport::Wrapper
module Puppet::Util::NetworkDevice::<%= name.capitalize %> # rubocop:disable Style/ClassAndModuleCamelCase
# Bridging from puppet to the <%= name %> transport
class Device < Puppet::ResourceApi::Transport::Wrapper
def initialize(url_or_config, _options = {})
super('<%= name %>', url_or_config)
end
end
end
2 changes: 1 addition & 1 deletion object_templates/transport_type.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'puppet/resource_api'

Puppet::ResourceApi.register_transport(
name: '<%= name %>',
docs: <<-EOS,
desc: <<-EOS,
This transport provides Puppet with the capability to connect to <%= name %> targets.
EOS
features: [],
Expand Down

0 comments on commit f9d066a

Please sign in to comment.