Class: RestFtpDaemon::Remote::RemoteBase

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

Direct Known Subclasses

RemoteFTP, RemoteS3, RemoteSFTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonHelpers

#dashboard_url, #exception_to_error, #format_bytes, #identifier, #underscore

Constructor Details

#initialize(target, context, debug = false, ftpes = false) ⇒ RemoteBase

Returns a new instance of RemoteBase.



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

def initialize target, context, 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
  @context = context || {}
  log_pipe :transfer

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

  # Prepare real object
  prepare
end

Instance Attribute Details

#jobObject

Returns the value of attribute job.



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

def job
  @job
end

#log_prefixObject (readonly)

Class options



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

def log_prefix
  @log_prefix
end

Instance Method Details

#chdir_or_create(directory, mkdir = false) ⇒ Object



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

def chdir_or_create directory, mkdir = false
end

#closeObject



61
62
63
64
65
66
67
# File 'lib/rest-ftp-daemon/remote/base.rb', line 61

def close
  log_debug "close"

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

#connectObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rest-ftp-daemon/remote/base.rb', line 43

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



40
41
# File 'lib/rest-ftp-daemon/remote/base.rb', line 40

def prepare
end

#remove!(target) ⇒ Object



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

def remove! target
end

#size_if_exists(target) ⇒ Object



36
37
38
# File 'lib/rest-ftp-daemon/remote/base.rb', line 36

def size_if_exists target
  false
end