oats_agent 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/oats_agent CHANGED
@@ -19,20 +19,4 @@ Log4r::StdoutOutputter.new('console', :level=>1,
19
19
  $log = Log4r::Logger.new('R')
20
20
  $log.add('console')
21
21
  options = OatsAgent::CommandlineOptions.options(ARGV.dup)
22
- if options["agent_host"].nil? or options["agent_host"] == ENV['HOSTNAME']
23
- OatsAgent.spawn(options)
24
- else
25
- params = ARGV.dup
26
- if RUBY_PLATFORM =~ /(mswin|mingw)/
27
- cmd = "psexec.exe -d -i -n 10 -w " + ENV['HOME'] + '/results_archive' +
28
- ' -u qa -p ' + 'passwd' + ' \\\\' + options["agent_host"] +
29
- ' ruby oats_agent ' + params.join(' ')
30
- else
31
- # params.delete('-a')
32
- # params.delete(options["agent_host"])
33
- # options['agent_host'] = ENV['HOSTNAME']
34
- cmd = "ssh " + options["agent_host"] + ' oats_agent ' + params.join(' ')
35
- end
36
- out = `#{cmd}`
37
- $log.info out unless out == ''
38
- end
22
+ OatsAgent.spawn(options)
data/lib/oats_agent.rb CHANGED
@@ -65,7 +65,6 @@ module OatsAgent
65
65
  # optional: oats_user, test_directory, repository_version
66
66
 
67
67
  def spawn(options)
68
- agent_host = options["agent_host"] || ENV['HOSTNAME']
69
68
  nick = options["nickname"] || ENV['HOSTNAME']
70
69
  port = options["port"] || 3010
71
70
  port = port.to_s
@@ -79,7 +78,26 @@ module OatsAgent
79
78
  config_file = "#{log_dir}/config-agent.txt"
80
79
  agent_log_file = "#{log_dir}/agent.log"
81
80
  params = "-n #{nick} -p #{port}"
82
-
81
+
82
+ agent_params = params.dup
83
+ agent_params += "-r #{repo_version}" if repo_version
84
+ agent_params += "-u #{user}" if user
85
+ if options["agent_host"] and options["agent_host"] != ENV['HOSTNAME']
86
+ if RUBY_PLATFORM =~ /(mswin|mingw)/
87
+ cmd = "psexec.exe -d -i -n 10 -w " + archive_dir +
88
+ ' -u qa -p ' + 'passwd' + ' \\\\' + options["agent_host"] +
89
+ ' ruby oats_agent ' + agent_params.join(' ')
90
+ else
91
+ # options['agent_host'] = ENV['HOSTNAME']
92
+ cmd = "ssh " + options["agent_host"] + ' oats_agent ' + agent_params
93
+ end
94
+ $log.info "Issuing remote host request: #{cmd}"
95
+ out = `#{cmd}`
96
+ $log.info out unless out == ''
97
+ return
98
+ end
99
+
100
+
83
101
  FileUtils.mkdir_p(log_dir) unless File.exists?(log_dir)
84
102
  ENV['OATS_AGENT_LOGFILE'] = log_file
85
103
 
@@ -88,7 +106,7 @@ module OatsAgent
88
106
  # Need these off when called by OCC, otherwise the OCC values are inherited
89
107
  %w(RUBYOPT BUNDLE_BIN_PATH BUNDLE_GEMFILE).each { |e| ENV[e] = nil }
90
108
  kill_matching ruby_cmd
91
- exit if options["kill_agent"]
109
+ return if options["kill_agent"]
92
110
 
93
111
  if File.directory?(dir_tests + '/.svn') and ENV['OATS_TESTS_SVN_REPOSITORY']
94
112
  svn_out =nil
@@ -1,3 +1,3 @@
1
1
  module OatsAgent
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oats_agent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Levent Atasoy