ralsh in edit mode generates a highly predictable filename; since we actually
want it to linger at the end of the process, we only take care that the file
didn't exist before we tried to create it.
---
lib/puppet/application/ralsh.rb | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/puppet/application/ralsh.rb b/lib/puppet/application/ralsh.rb
index b9f7a58..51c3daa 100644
--- a/lib/puppet/application/ralsh.rb
+++ b/lib/puppet/application/ralsh.rb
@@ -1,6 +1,7 @@
require 'puppet'
require 'puppet/application'
require 'facter'
+require 'tempfile'
Puppet::Application.new(:ralsh) do
@@ -121,7 +122,7 @@ Puppet::Application.new(:ralsh) do
if options[:edit]
file = "/tmp/x2puppet-#{Process.pid}.pp"
begin
- File.open(file, "w") do |f|
+ File.open(file, File::WRONLY|File::CREAT|File::EXCL) do |f|
f.puts text
end
ENV["EDITOR"] ||= "vi"
--
1.7.0.4
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.