Sha256: 4446f544dc0f8880263f5767d62024c3e2b4b9febd4814a8a744f81fea1806e0

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

require 'net/sftp'

module Docman

  class SSHTargetChecker < Docman::TargetChecker
    register_checker :ssh

    def execute
      filename = File.join(self['file_path'], self['filename'])
      Net::SFTP.start(self['ssh_host'], self['ssh_user']) do |sftp|
        n = 0
        begin
          sleep 15
          n+=1
          log "Checking if files deployed, retry ##{n}, filename: #{filename}"
          sftp.stat!(filename) do |response|
            unless response.ok?
              sleep 15
            end
          end
          data = YAML.load sftp.download!(filename)
        end until data['random'] == self['version']
      end
      true
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
docman-0.0.14 lib/docman/commands/ssh_target_checker.rb
docman-0.0.13 lib/docman/commands/ssh_target_checker.rb
docman-0.0.12 lib/docman/commands/ssh_target_checker.rb