Skip to content

Commit a4b59f2

Browse files
authored
Merge pull request #758 from sathieu/file_line_ruby18
Ruby 1.8 doesn't support open_args
2 parents b7af918 + ec720cf commit a4b59f2

File tree

1 file changed

+6
-1
lines changed
  • lib/puppet/provider/file_line

1 file changed

+6
-1
lines changed

lib/puppet/provider/file_line/ruby.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def lines
4040
# file; for now assuming that this type is only used on
4141
# small-ish config files that can fit into memory without
4242
# too much trouble.
43-
@lines ||= File.readlines(resource[:path], :encoding => resource[:encoding])
43+
begin
44+
@lines ||= File.readlines(resource[:path], :encoding => resource[:encoding])
45+
rescue TypeError => e
46+
# Ruby 1.8 doesn't support open_args
47+
@lines ||= File.readlines(resource[:path])
48+
end
4449
end
4550

4651
def match_regex

0 commit comments

Comments
 (0)