Class: RestFtpDaemon::Remote

Inherits:
Object
  • Object
show all
Includes:
BmcDaemonLib::LoggerHelper
Defined in:
lib/rest-ftp-daemon/remote.rb

Direct Known Subclasses

RemoteFTP, RemoteS3, RemoteSFTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, log_prefix, debug = false, ftpes = false) ⇒ Remote

Returns a new instance of Remote.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rest-ftp-daemon/remote.rb', line 14

def initialize target, log_prefix, debug = false, ftpes = false
  # Init
  @target = target
  @ftpes = ftpes
  @debug = !!debug

  # Build and empty job to protect set_info delegation
  @job = Job.new(nil, {})

  # Logger
  @log_prefix = log_prefix || {}
  @logger = BmcDaemonLib::LoggerPool.instance.get :transfer

  # Annnounce object
  log_info "Remote.initialize debug[#{debug}] target[#{target.path}] "

  # Prepare real object
  prepare
end

Instance Attribute Details

#jobObject

Returns the value of attribute job.



9
10
11
# File 'lib/rest-ftp-daemon/remote.rb', line 9

def job
  @job
end

#log_prefixObject (readonly)

Returns the value of attribute log_prefix.



8
9
10
# File 'lib/rest-ftp-daemon/remote.rb', line 8

def log_prefix
  @log_prefix
end

#loggerObject (readonly)

Class options



7
8
9
# File 'lib/rest-ftp-daemon/remote.rb', line 7

def logger
  @logger
end

Instance Method Details

#chdir_or_create(directory, mkdir = false) ⇒ Object



49
50
# File 'lib/rest-ftp-daemon/remote.rb', line 49

def chdir_or_create directory, mkdir = false
end

#closeObject



55
56
57
58
59
# File 'lib/rest-ftp-daemon/remote.rb', line 55

def close
  # Debug mode ?
  return unless @debug
  puts "-------------------- SESSION CLOSING --------------------------"
end

#connectObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rest-ftp-daemon/remote.rb', line 37

def connect
  # Debug mode ?
  return unless @debug
  puts
  puts "-------------------- SESSION STARTING -------------------------"
  puts "class\t #{myname}"
  puts "host\t #{@target.host}"
  puts "user\t #{@target.user}"
  puts "port\t #{@target.port}"
  puts "---------------------------------------------------------------"
end

#prepareObject



34
35
# File 'lib/rest-ftp-daemon/remote.rb', line 34

def prepare
end

#remove!(target) ⇒ Object



52
53
# File 'lib/rest-ftp-daemon/remote.rb', line 52

def remove! target
end