lib/scout/command/run.rb in scout-5.3.5 vs lib/scout/command/run.rb in scout-5.4.4.alpha
- old
+ new
@@ -7,19 +7,31 @@
key = @args.first
# TODO: this is an awkward way to force creation of the config directory. Could use a little refactoring.
configuration_directory = config_dir
log.debug("Configuration directory is #{configuration_directory} ") if log
# TODO: too much external logic of command doing things TO server. This should be moved into the server class.
- @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy)
+ @scout = Scout::Server.new(server, key, history, log, server_name)
@scout.load_history
unless $stdin.tty?
log.info "Sleeping #{@scout.sleep_interval} sec" if log
sleep @scout.sleep_interval
end
@scout.fetch_plan
+ log.info "streamer command=#{@scout.streamer_command}"
+ # Spawn streamer if directed to, or stop it. @scout.streamer_command should only be [start|stop]
+ if @scout.streamer_command.is_a?(String) && @scout.streamer_command.start_with?("start") || @scout.streamer_command == "stop"
+ tokens = @scout.streamer_command.split(",")
+ tokens.shift # gets rid of the "start"
+ streaming_key=tokens.shift
+ plugin_ids = tokens.map(&:to_i)
+ stream=Scout::Command::Stream.new(@options.merge(:streaming_key=>streaming_key,:plugin_ids=>plugin_ids), [key, @scout.streamer_command])
+ stream.run
+ end
+
+ # Check in if appropriate
if @scout.new_plan || @scout.time_to_checkin? || @force
if @scout.new_plan
log.info("Now checking in with new plugin plan") if log
elsif @scout.time_to_checkin?
log.info("It is time to checkin") if log