Sha256: 6f0941dd82a0dd57ffca980b04ae1b51ed87049e4889e9adb85f4db2d2bfb39e

Contents?: true

Size: 579 Bytes

Versions: 15

Compression:

Stored size: 579 Bytes

Contents

module WatchmonkeyCli
  module Checkers
    class FtpAvailability < Checker
      self.checker_name = "ftp_availability"

      def enqueue host, opts = {}
        opts = { threshold: 1.months }.merge(opts)
        app.enqueue(self, host, opts)
      end

      def check! result, host, opts = {}
        Net::FTP.open(host) do |ftp|
          ftp.login(opts[:user], opts[:password])
        end
      rescue Net::FTPPermError
        result.error! "Invalid credentials!"
      rescue SocketError => e
        result.error! "#{e.class}: #{e.message}"
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
watchmonkey_cli-1.11.0 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.10.0 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.9.1 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.9.0 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8.6 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8.5 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8.4 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8.3 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8.2 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8.1 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.8 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.7.1 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.7 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.6 lib/watchmonkey_cli/checkers/ftp_availability.rb
watchmonkey_cli-1.5 lib/watchmonkey_cli/checkers/ftp_availability.rb