File tree 3 files changed +11
-0
lines changed
fixtures/unit/application/environments/production/data
3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 3
3
require_relative '../../puppet/application'
4
4
require_relative '../../puppet/pops'
5
5
require_relative '../../puppet/node'
6
+ require_relative '../../puppet/node/server_facts'
6
7
require_relative '../../puppet/parser/compiler'
7
8
8
9
class Puppet ::Application ::Lookup < Puppet ::Application
@@ -403,6 +404,7 @@ def generate_scope
403
404
end
404
405
end
405
406
node . environment = Puppet [ :environment ] if Puppet . settings . set_by_cli? ( :environment )
407
+ node . add_server_facts ( Puppet ::Node ::ServerFacts . load )
406
408
Puppet [ :code ] = 'undef' unless options [ :compile ]
407
409
compiler = Puppet ::Parser ::Compiler . new ( node )
408
410
if options [ :node ]
Original file line number Diff line number Diff line change @@ -20,5 +20,7 @@ ab: "%{hiera('a')} and %{hiera('b')}"
20
20
21
21
g : " This is%{facts.cx} in facts hash"
22
22
23
+ h : " server version is %{server_facts.serverversion}"
24
+
23
25
lookup_options :
24
26
a : first
Original file line number Diff line number Diff line change @@ -546,6 +546,13 @@ def run_lookup(lookup)
546
546
expect ( run_lookup ( lookup ) ) . to eql ( "This is G from facts in facts hash" )
547
547
end
548
548
549
+ it 'looks up server facts' do
550
+ lookup . options [ :node ] = node
551
+ lookup . options [ :render_as ] = :s
552
+ allow ( lookup . command_line ) . to receive ( :args ) . and_return ( [ 'h' ] )
553
+ expect ( run_lookup ( lookup ) ) . to eql ( "server version is #{ Puppet . version } " )
554
+ end
555
+
549
556
describe 'when retrieving given facts' do
550
557
before do
551
558
lookup . options [ :node ] = node
You can’t perform that action at this time.
0 commit comments