Sha256: 395afe03a869a52dc7a8bf78bc1f402c8ef01b9035e3615018d2c4e11b7a9c97

Contents?: true

Size: 726 Bytes

Versions: 1

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
          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)
          sleep 30
        end until data['random'] == self['version']
      end
      true
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docman-0.0.6 lib/docman/commands/ssh_target_checker.rb