File tree 4 files changed +20
-2
lines changed
4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -920,7 +920,10 @@ Naming/VariableNumber:
920
920
# SupportedStyles: inline, group
921
921
Style/AccessModifierDeclarations :
922
922
Exclude :
923
+ - ' lib/puppet/util/command_line/trollop.rb'
923
924
- ' lib/puppet/util/suidmanager.rb'
925
+ - ' lib/puppet/util/windows/com.rb'
926
+ - ' lib/puppet/util/windows/monkey_patches/process.rb'
924
927
925
928
# This cop supports safe auto-correction (--auto-correct).
926
929
# Configuration parameters: EnforcedStyle.
Original file line number Diff line number Diff line change 164
164
165
165
case result
166
166
when Array , Hash
167
- Puppet ::Util ::Json . dump ( result , :pretty => true )
167
+ # JSON < 2.8.0 would pretty print empty arrays and hashes with newlines
168
+ # Maintain that behavior for our users for now
169
+ if result . is_a? ( Array ) && result . empty?
170
+ "[\n \n ]"
171
+ elsif result . is_a? ( Hash ) && result . empty?
172
+ "{\n }"
173
+ else
174
+ Puppet ::Util ::Json . dump ( result , :pretty => true )
175
+ end
168
176
else # one of VALID_TYPES above
169
177
result
170
178
end
Original file line number Diff line number Diff line change 91
91
92
92
{
93
93
"type_hash" => [ { 'a' => 2 } , "{\n \" a\" : 2\n }" ] ,
94
+ "type_empty_hash" => [ { } , "{\n }" ] ,
94
95
"type_array" => [ [ ] , "[\n \n ]" ] ,
95
96
"type_string" => [ "str" , "str" ] ,
96
97
"type_int" => [ 1 , "1" ] ,
Original file line number Diff line number Diff line change 77
77
78
78
it "raises if given an invalid URI" do
79
79
resource [ :source ] = 'h;ttp://rubygems.com'
80
- expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI\( is not URI\? \) / )
80
+ # Older versions of URI don't have a space before the opening
81
+ # parenthesis in the error message, newer versions do
82
+ if Gem ::Version . new ( RUBY_VERSION . dup ) < Gem ::Version . new ( '3.0.0' )
83
+ expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI\( is not URI\? \) / )
84
+ else
85
+ expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI \( is not URI\? \) / )
86
+ end
81
87
end
82
88
end
83
89
end
You can’t perform that action at this time.
0 commit comments