Skip to content

Commit

Permalink
expect command now on /tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Troy Stribling committed Jun 9, 2011
1 parent 9c84f39 commit 1b7a166
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/apigee_shell.rb
Expand Up @@ -51,15 +51,15 @@ def send_apigee_shell_command(env, vm, cmd)
begin
try_count += 1
exe_time = Time.now.to_f
cmd_file = File.new("apigee_cmd:#{vm['ip']}", 'w')
cmd_file = Tempfile.new("apigee_cmd:#{vm['ip']}")
cmd_file.chmod(0744)
cmd_file << cmd
cmd_file.close
response = `#{File.absolute_path(cmd_file.path)}`
response = `#{cmd_file.path}`
raise(ApiGeeShellTimeout) if response.include?('timed out')
raise(ApiGeeShellConnectionRefused) if response.include?('Connection refused')
raise(ApiGeeShellAuthenitcationFailed) if response.include?("\r\n\r\nPassword: \r\nPassword: \r\n")
File.delete(File.absolute_path(cmd_file.path))
cmd_file.delete
elapsed_time = (1000*(Time.now.to_f - exe_time)).to_i
ApiGeeConfig.logger.info "COMMAND SUCCEEDED IN #{elapsed_time}ms"
ApiGeeConfig.logger.info "RECEIVED RESPONSE #{response}"
Expand Down

0 comments on commit 1b7a166

Please sign in to comment.