lib/pdk/generate/puppet_object.rb in pdk-1.7.1 vs lib/pdk/generate/puppet_object.rb in pdk-1.8.0
- old
+ new
@@ -3,10 +3,11 @@
require 'pdk'
require 'pdk/logger'
require 'pdk/module/metadata'
require 'pdk/module/templatedir'
require 'pdk/template_file'
+require 'pdk/util/filesystem'
module PDK
module Generate
class PuppetObject
attr_reader :module_dir
@@ -178,10 +179,10 @@
path: File.dirname(dest_path),
message: e.message,
}
end
- File.open(dest_path, 'w') { |f| f.write file_content }
+ PDK::Util::Filesystem.write_file(dest_path, file_content)
rescue SystemCallError => e
raise PDK::CLI::FatalError, _("Unable to write to file '%{path}': %{message}") % {
path: dest_path,
message: e.message,
}