Class: Puppet::ResourceApi::BaseContext

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/puppetlabs/panos/transport_shim.rb

Overview

monkey patch for the transport context for continued module support

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ BaseContext

Returns a new instance of BaseContext.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet_x/puppetlabs/panos/transport_shim.rb', line 18

def initialize(definition)
  if definition.is_a?(Hash)
    # this is only for backwards compatibility
    @type = Puppet::ResourceApi::TypeDefinition.new(definition)
  elsif definition.is_a? Puppet::ResourceApi::BaseTypeDefinition
    @type = definition
  else
    #:nocov:
    raise ArgumentError, 'BaseContext requires definition to be a child of Puppet::ResourceApi::BaseTypeDefinition, not <%{actual_type}>' % { actual_type: definition.class }
    #:nocov:
  end
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



16
17
18
# File 'lib/puppet_x/puppetlabs/panos/transport_shim.rb', line 16

def type
  @type
end

Instance Method Details

#transportObject

:nocov: patch for returning the device in the context.transport calls



34
35
36
# File 'lib/puppet_x/puppetlabs/panos/transport_shim.rb', line 34

def transport
  device.transport
end