def run(options, &callback)
      fail('Missing identity or name argument', true) unless options[:id] || options[:name]

      fail_if_right_agent_is_not_running

      echo(options)
      cmd = { :name => cmd_name, :options => to_forwarder_options(options) }
      AgentConfig.cfg_dir = options[:cfg_dir]

      exit_code = true
      callback ||= lambda do |r|
        response = serialize_operation_result(r) rescue nil
        if r == 'OK'
          puts "Request sent successfully"
        elsif response.respond_to?(:success?) && response.success?
          puts "Request processed successfully"
        else
          puts "Failed to process request (#{(response.respond_to?(:content) && response.content) || '<unknown error>'})"
          exit_code = false
        end
      end

      begin
        check_privileges
        timeout = options[:timeout] || DEFAULT_TIMEOUT
        send_command(cmd, options[:verbose], timeout) { |r| callback.call(r) }
      rescue Exception => e
        fail(e.message)
      end
      exit_code
    rescue SystemExit => e
      raise e
    rescue Exception => e
      fail(e)
    end
def run(options, &callback)
      fail('Missing identity or name argument', true) unless options[:id] || options[:name]

      fail_if_right_agent_is_not_running

      echo(options)
      cmd = { :name => cmd_name, :options => to_forwarder_options(options) }
      AgentConfig.cfg_dir = options[:cfg_dir]

      exit_code = true
      callback ||= lambda do |r|
        response = serialize_operation_result(r) rescue nil
        if r == 'OK'
          puts "Request sent successfully"
        elsif response.respond_to?(:success?) && response.success?
          puts "Request processed successfully"
        else
          puts "Failed to process request (#{(response.respond_to?(:content) && response.content) || '<unknown error>'})"
          exit_code = false
        end
      end

      begin
        check_privileges
        timeout = options[:timeout] || DEFAULT_TIMEOUT
        send_command(cmd, options[:verbose], timeout) { |r| callback.call(r) }
      rescue Exception => e
        fail(e.message)
      end
      exit_code
    rescue SystemExit => e
      raise e
    rescue Exception => e
      fail(e)
    end
Run recipe or RightScript (that is, schedule it)

 === Parameters
 options(Hash):: Hash of options as defined in +parse_args+

 === Block
 If a block is given, it should take one argument corresponding to the
 reply sent back by the agent

 === Return
 true:: If everything went smoothly
 false:: If something terrible happened