Class: Docman::SSHTargetChecker

Inherits:
TargetChecker show all
Defined in:
lib/docman/commands/ssh_target_checker.rb

Instance Attribute Summary

Attributes inherited from Command

#type

Instance Method Summary collapse

Methods inherited from TargetChecker

create, register_checker

Methods inherited from Command

#add_action, #add_actions, #config, create, #describe, #initialize, #perform, #prefix, register_command, #replace_placeholder, #run_actions, #run_with_hooks

Methods included from Logging

#log, logger, #logger, #prefix, #properties_info, #with_logging

Constructor Details

This class inherits a constructor from Docman::Command

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/docman/commands/ssh_target_checker.rb', line 9

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