summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppet.com>2017-04-19 08:07:15 -0700
committerGitHub <noreply@github.com>2017-04-19 08:07:15 -0700
commita4b59f2a566ba140d3108b87fc8b6b988ae5fe96 (patch)
treeb90ce208c91c18456880dde5f522d2b2c3fa80fa
parentb7af918d11f108c0ad9add9e365bf8da0c3bcdc4 (diff)
parentec720cf8808b231ce3756c19d9176723b56bde37 (diff)
Merge pull request #758 from sathieu/file_line_ruby18
Ruby 1.8 doesn't support open_args
-rw-r--r--lib/puppet/provider/file_line/ruby.rb7
1 files changed, 6 insertions, 1 deletions
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