File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
lib/puppet/resource_api/transport
spec/puppet/resource_api/transport Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,13 @@ def initialize(name, url_or_config)
1717 end
1818
1919 @transport = Puppet ::ResourceApi ::Transport . connect ( name , config )
20+ @schema = Puppet ::ResourceApi ::Transport . list [ name ]
2021 end
2122
2223 def facts
24+ context = Puppet ::ResourceApi ::PuppetContext . new ( @schema )
2325 # @transport.facts + custom_facts # look into custom facts work by TP
24- @transport . facts ( nil )
26+ @transport . facts ( context )
2527 end
2628
2729 def respond_to_missing? ( name , _include_private )
Original file line number Diff line number Diff line change 3737 describe '#facts' do
3838 context 'when called' do
3939 let ( :instance ) { described_class . new ( 'wibble' , { } ) }
40+ let ( :context ) { instance_double ( Puppet ::ResourceApi ::PuppetContext , 'context' ) }
4041 let ( :facts ) { { 'foo' => 'bar' } }
4142 let ( :transport ) { instance_double ( Puppet ::Transport ::TestDevice , 'transport' ) }
4243
4344 it 'will return the facts provided by the transport' do
4445 allow ( Puppet ::ResourceApi ::Transport ) . to receive ( :connect ) . and_return ( transport )
45- allow ( transport ) . to receive ( :facts ) . with ( nil ) . and_return ( facts )
46+ allow ( Puppet ::ResourceApi ::Transport ) . to receive ( :list ) . and_return ( schema : :dummy )
47+ allow ( Puppet ::ResourceApi ::PuppetContext ) . to receive ( :new ) . and_return ( context )
48+ allow ( transport ) . to receive ( :facts ) . with ( context ) . and_return ( facts )
4649
4750 expect ( instance . facts ) . to eq ( facts )
4851 end
You can’t perform that action at this time.
0 commit comments