Sha256: c28d74a9ebcbd1d14e63bd6eb42034c7d87cf634ec17989e582ab08c3f2431c9

Contents?: true

Size: 726 Bytes

Versions: 5

Compression:

Stored size: 726 Bytes

Contents

require 'net/sftp'

module Docman

  class SSHTargetChecker < Docman::TargetChecker
    register_checker :ssh

    def execute
      filename = File.join(self['file_path'], @context['docroot_name'] + @context['environment'], 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

5 entries across 5 versions & 1 rubygems

Version Path
docman-0.0.11 lib/docman/commands/ssh_target_checker.rb
docman-0.0.10 lib/docman/commands/ssh_target_checker.rb
docman-0.0.9 lib/docman/commands/ssh_target_checker.rb
docman-0.0.8 lib/docman/commands/ssh_target_checker.rb
docman-0.0.7 lib/docman/commands/ssh_target_checker.rb