Browse files

Fixed a bug: running pocketknife against the same machine with two di…

…fferent users could lead to collision on the temporary file and created a failure. Improved the separation of temporary files used by different users.
  • Loading branch information...
1 parent c48bef9 commit 2bfdfdfc1cd061bba8d9dc4c339bafcae5801ba1 @matlux committed Apr 28, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/pocketknife/node.rb
View
9 lib/pocketknife/node.rb
@@ -24,7 +24,12 @@ def initialize(name, pocketknife)
self.pocketknife = pocketknife
self.connection_cache = nil
@user = self.pocketknife.user
- @working_dir = Pathname.new("/tmp/chefwork")
+
+
+ workdir = "/home/#{@user}/chefwork" if @user != "root"
+ workdir = "/root/chefwork" if @user == "root"
+
+ @working_dir = Pathname.new("/home/#{@user}/chefwork")
puts "@working_dir=#{@working_dir}"
# Remote path to Chef's settings
@@ -96,7 +101,7 @@ def connection
end
options = {:user => user }
if self.pocketknife.password
- puts "Connecting to.... #{self.name} as user #{user} with ssh key"
+ puts "Connecting to.... #{self.name} as user #{user} with password file"
options[:password] = self.pocketknife.password
end
if self.pocketknife.ssh_key != nil and self.pocketknife.ssh_key != ""

0 comments on commit 2bfdfdf

Please sign in to comment.