require 'flydata/helper/action/agent_action' module Flydata module Helper module Action class Flush < AgentAction def command(opts = {}) "sync:flush -y %s" % [build_options(opts)] end def build_options(opts) opt_str = "" if config_hash(opts)[:skip_flush] # skip server flush opt_str << " --skip-flush" end timeout = config_hash(opts)[:server_timeout].to_i if timeout > 0 && timeout <= 3600 # max 1 hour opt_str << " --server-timeout #{timeout}" end if !!config_hash(opts)[:dont_wait_upload] opt_str << " --dont-wait-upload" end opt_str end end end end end