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 1
1
require_relative '../../puppet/application'
2
2
require_relative '../../puppet/pops'
3
3
require_relative '../../puppet/node'
4
+ require_relative '../../puppet/node/server_facts'
4
5
require_relative '../../puppet/parser/compiler'
5
6
6
7
class Puppet ::Application ::Lookup < Puppet ::Application
@@ -406,6 +407,7 @@ def generate_scope
406
407
node . add_extra_facts ( given_facts ) if given_facts
407
408
end
408
409
node . environment = Puppet [ :environment ] if Puppet . settings . set_by_cli? ( :environment )
410
+ node . add_server_facts ( Puppet ::Node ::ServerFacts . load )
409
411
Puppet [ :code ] = 'undef' unless options [ :compile ]
410
412
compiler = Puppet ::Parser ::Compiler . new ( node )
411
413
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 @@ -543,6 +543,13 @@ def run_lookup(lookup)
543
543
expect ( run_lookup ( lookup ) ) . to eql ( "This is G from facts in facts hash" )
544
544
end
545
545
546
+ it 'looks up server facts' do
547
+ lookup . options [ :node ] = node
548
+ lookup . options [ :render_as ] = :s
549
+ allow ( lookup . command_line ) . to receive ( :args ) . and_return ( [ 'h' ] )
550
+ expect ( run_lookup ( lookup ) ) . to eql ( "server version is #{ Puppet . version } " )
551
+ end
552
+
546
553
describe 'when retrieving given facts' do
547
554
before do
548
555
lookup . options [ :node ] = node
You can’t perform that action at this time.
0 commit comments