summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBryan McLellan <btm@opscode.com>2014-03-17 09:30:42 -0700
committerBryan McLellan <btm@getchef.com>2014-03-19 14:39:24 -0700
commitc1e47c10abf83e61e02e782dc7f92f8ba812f3eb (patch)
tree40b0da286e27152eaac0f69a18548334214626ee /lib
parent371b391f8198acaf16766d46eafffd7a2226de0c (diff)
downloadchef-c1e47c10abf83e61e02e782dc7f92f8ba812f3eb.tar.gz
CHEF-3714: Check for file existence before opening
Add back an existence check for the file passed to FileEdit Signed-off-by: Bryan McLellan <btm@opscode.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/util/file_edit.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb
index 50e4f3de33..f4a3cde540 100644
--- a/lib/chef/util/file_edit.rb
+++ b/lib/chef/util/file_edit.rb
@@ -29,6 +29,7 @@ class Chef
public
def initialize(filepath)
+ raise ArgumentError, "File '#{filepath}' does not exist" unless File.exist?(filepath)
@editor = Editor.new(File.open(filepath, &:readlines))
@original_pathname = filepath
end