From ec720cf8808b231ce3756c19d9176723b56bde37 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Tue, 18 Apr 2017 13:16:39 +0200 Subject: Ruby 1.8 doesn't support open_args Regression from #726 --- lib/puppet/provider/file_line/ruby.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/puppet/provider/file_line/ruby.rb b/lib/puppet/provider/file_line/ruby.rb index fbf7d8e..42f287a 100644 --- a/lib/puppet/provider/file_line/ruby.rb +++ b/lib/puppet/provider/file_line/ruby.rb @@ -40,7 +40,12 @@ Puppet::Type.type(:file_line).provide(:ruby) do # file; for now assuming that this type is only used on # small-ish config files that can fit into memory without # too much trouble. - @lines ||= File.readlines(resource[:path], :encoding => resource[:encoding]) + begin + @lines ||= File.readlines(resource[:path], :encoding => resource[:encoding]) + rescue TypeError => e + # Ruby 1.8 doesn't support open_args + @lines ||= File.readlines(resource[:path]) + end end def match_regex -- cgit v1.2.3