File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 132
132
Puppet ::Node ::Facts . indirection . terminus_class = :facter
133
133
134
134
if Puppet ::Util ::Package . versioncmp ( Facter . value ( 'facterversion' ) , '4.0.0' ) < 0
135
- facter3_result = Puppet :: Node :: Facts . indirection . find ( Puppet . settings [ :certname ] )
135
+ cmd_flags = '--render-as json --show-legacy'
136
136
137
137
# puppet/ruby are in PATH since it was updated in the wrapper script
138
- puppet_cmd = ' puppet facts show --facterng --render-as json'
138
+ puppet_show_cmd = " puppet facts show"
139
139
if Puppet ::Util ::Platform . windows?
140
- puppet_cmd = "ruby -S -- puppet facts show --render-as json "
140
+ puppet_show_cmd = "ruby -S -- #{ puppet_show_cmd } "
141
141
end
142
- facter4_result = Puppet ::Util ::Execution . execute ( puppet_cmd )
143
142
144
- fact_diff = FactDif . new ( facter3_result . to_json , facter4_result , EXCLUDE_LIST )
143
+ facter_3_result = Puppet ::Util ::Execution . execute ( "#{ puppet_show_cmd } --no-facterng #{ cmd_flags } " )
144
+ facter_ng_result = Puppet ::Util ::Execution . execute ( "#{ puppet_show_cmd } --facterng #{ cmd_flags } " )
145
+
146
+ fact_diff = FactDif . new ( facter_3_result , facter_ng_result , EXCLUDE_LIST )
145
147
fact_diff . difs
146
148
else
147
149
Puppet . warning _ ( "Already using Facter 4. To use `puppet facts diff` remove facterng from the .conf file or run `puppet config set facterng false`." )
Original file line number Diff line number Diff line change 2
2
3
3
class FactDif
4
4
def initialize ( old_output , new_output , exclude_list = [ ] )
5
- @c_facter = JSON . parse ( old_output ) [ 'values' ]
6
- @next_facter = JSON . parse ( new_output ) [ 'values' ]
5
+ @c_facter = JSON . parse ( old_output )
6
+ @next_facter = JSON . parse ( new_output )
7
7
@exclude_list = exclude_list
8
8
@diff = { }
9
9
end
You can’t perform that action at this time.
0 commit comments