rest-ftp-daemon 0.410.5 → 0.420.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fa821b4974f3c450b6ba939b7d550056f567f61
4
- data.tar.gz: 5e63689d2ef91e6a28046824086da73e1519f78f
3
+ metadata.gz: a1dc08f8d5c0fc9a671b36144561e504e25bb80e
4
+ data.tar.gz: 9e8eae9daf0a21d56f6fe6c27a32d19327fc099e
5
5
  SHA512:
6
- metadata.gz: 38976cb5fbdd2ba3adafc8423eec17b2db16c9b022ad53b7c34ce3b57cf2f936a26b328e7abdbb6483a337597d852b35e3f94a5aef5c1587391856db6eda7ba8
7
- data.tar.gz: 63cf9c1429b5ac2ffcbb7a0a3a7160de6e1ebedbc74505b399e4d437ee30fe323cd9533c7cb1933aff649a4fbb9576d0652da710df511a74a9a8f0cbb377f653
6
+ metadata.gz: 08d906444c38c286123f1eacef7f7c37ba30ff64ea9a4da83913c745514288eeefda8ee8bdcfe1f8de52f2c29132cb2fcfa902f978b600fc387439970978b6e8
7
+ data.tar.gz: d4a131e6f37dca12e5478443e2bfffb2975de3ae59481c67c47428eedabaeee045866a17640c0e1875be5357cdb29726f3052f4b314fe0660bc4d6dd15a0db66
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-ftp-daemon (0.410.5)
4
+ rest-ftp-daemon (0.420.1)
5
5
  activesupport (~> 4.2)
6
6
  api-auth
7
+ aws-sdk-resources (~> 2)
7
8
  bmc-daemon-lib (~> 0.3.4)
8
9
  double-bag-ftps
9
10
  facter
@@ -38,6 +39,10 @@ GEM
38
39
  ast (2.3.0)
39
40
  astrolabe (1.3.1)
40
41
  parser (~> 2.2)
42
+ aws-sdk-core (2.5.7)
43
+ jmespath (~> 1.0)
44
+ aws-sdk-resources (2.5.7)
45
+ aws-sdk-core (= 2.5.7)
41
46
  axiom-types (0.1.1)
42
47
  descendants_tracker (~> 0.0.4)
43
48
  ice_nine (~> 0.11.0)
@@ -102,6 +107,7 @@ GEM
102
107
  http_parser.rb (0.6.0)
103
108
  i18n (0.7.0)
104
109
  ice_nine (0.11.2)
110
+ jmespath (1.3.1)
105
111
  json (1.8.3)
106
112
  method_source (0.8.2)
107
113
  mime-types (2.99.2)
data/bin/rest-ftp-daemon CHANGED
@@ -59,11 +59,11 @@ begin
59
59
  command = ARGV.shift
60
60
 
61
61
  rescue OptionParser::InvalidOption => e
62
- abort "EXITING: InvalidOption: #{e.message} \n #{e.backtrace.to_yaml}"
62
+ abort "EXITING: InvalidOption: #{e.message}"
63
63
  rescue ConfigParseError => e
64
- abort "EXITING: ConfigParseError: #{e.message} \n #{e.backtrace.to_yaml}"
64
+ abort "EXITING: ConfigParseError: #{e.message}"
65
65
  rescue StandardError => e
66
- abort "EXITING: StandardError: #{e.message} \n #{e.backtrace.to_yaml}"
66
+ abort "EXITING: StandardError: #{e.message}"
67
67
  else
68
68
  abort parser.to_s unless ["start", "stop"].include? command
69
69
  end
data/defaults.yml CHANGED
@@ -29,6 +29,7 @@ transfer:
29
29
  timeout: 1800 # jobs running for longer than X seconds will be killed
30
30
  notify_after: 5 # wait at least X seconds between HTTP notifications
31
31
 
32
+ debug_s3: false
32
33
  debug_ftp: false
33
34
  debug_ftps: false
34
35
  debug_sftp: false
@@ -26,11 +26,13 @@ require_relative "rest-ftp-daemon/job_queue"
26
26
  require_relative "rest-ftp-daemon/counters"
27
27
  require_relative "rest-ftp-daemon/notification"
28
28
  require_relative "rest-ftp-daemon/location"
29
+ require_relative "rest-ftp-daemon/pretty_json"
29
30
 
30
31
  # Remotes
31
32
  require_relative "rest-ftp-daemon/remote"
32
33
  require_relative "rest-ftp-daemon/remote_ftp"
33
34
  require_relative "rest-ftp-daemon/remote_sftp"
35
+ require_relative "rest-ftp-daemon/remote_s3"
34
36
 
35
37
  # Jobs
36
38
  require_relative "rest-ftp-daemon/job"
@@ -7,6 +7,7 @@ require "grape"
7
7
  module RestFtpDaemon
8
8
  module API
9
9
  class Dashbaord < Grape::API
10
+ include BmcDaemonLib
10
11
 
11
12
  ### HELPERS
12
13
  helpers do
@@ -3,6 +3,7 @@ require "grape"
3
3
  module RestFtpDaemon
4
4
  module API
5
5
  class Debug < Grape::API
6
+ include BmcDaemonLib
6
7
 
7
8
  ### HELPERS
8
9
  helpers do
@@ -3,6 +3,7 @@ require "grape"
3
3
  module RestFtpDaemon
4
4
  module API
5
5
  class Jobs < Grape::API
6
+ include BmcDaemonLib
6
7
 
7
8
  ### ENDPOINTS
8
9
  desc "Read job with ID", http_codes: [
@@ -7,6 +7,7 @@ module RestFtpDaemon
7
7
  module API
8
8
  class Root < Grape::API
9
9
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
10
+ include BmcDaemonLib
10
11
 
11
12
  ### LOGGING & HELPERS
12
13
  helpers RestFtpDaemon::CommonHelpers
@@ -33,6 +34,7 @@ module RestFtpDaemon
33
34
  do_not_route_options!
34
35
  # version 'v1'
35
36
  format :json
37
+ formatter :json, PrettyJSON
36
38
  content_type :json, 'application/json; charset=utf-8'
37
39
 
38
40
 
@@ -4,6 +4,7 @@ require "get_process_mem"
4
4
  module RestFtpDaemon
5
5
  module API
6
6
  class Status < Grape::API
7
+ include BmcDaemonLib
7
8
 
8
9
  ### ENDPOINTS
9
10
  desc "Show daemon status"
@@ -38,6 +38,8 @@ module RestFtpDaemon
38
38
  "warning"
39
39
  when URI::FTPES, URI::FTPS, URI::SFTP
40
40
  "success"
41
+ when URI::S3
42
+ "primary"
41
43
  else
42
44
  "default"
43
45
  end
@@ -43,9 +43,13 @@ module RestFtpDaemon
43
43
  attr_reader name
44
44
  end
45
45
 
46
- def initialize job_id, params = {}
47
- # Call super
48
- # super()
46
+ def initialize job_id = nil, params = {}
47
+ # Minimal init
48
+ @infos = {}
49
+ @mutex = Mutex.new
50
+
51
+ # Skip if no job_id passed or null (mock Job)
52
+ return if job_id.nil?
49
53
 
50
54
  # Init context
51
55
  @id = job_id.to_s
@@ -56,7 +60,6 @@ module RestFtpDaemon
56
60
  @status = nil
57
61
  @runs = 0
58
62
  @wid = nil
59
- @infos = {}
60
63
 
61
64
  # Prepare configuration
62
65
  @config = Conf[:transfer] || {}
@@ -66,8 +69,6 @@ module RestFtpDaemon
66
69
  # Logger
67
70
  @logger = BmcDaemonLib::LoggerPool.instance.get :transfer
68
71
 
69
- # Protect with a mutex
70
- @mutex = Mutex.new
71
72
 
72
73
  # Import query params
73
74
  FIELDS.each do |name|
@@ -101,7 +102,6 @@ module RestFtpDaemon
101
102
  # Job has been prepared, reset infos
102
103
  set_status JOB_STATUS_PREPARED
103
104
  @infos = {}
104
- set_info :job, :prepared_at, Time.now
105
105
  set_info_location :source, @source_loc
106
106
  set_info_location :target, @target_loc
107
107
 
@@ -140,7 +140,7 @@ module RestFtpDaemon
140
140
  do_after
141
141
 
142
142
  rescue StandardError => exception
143
- log_debug "Job.process caught #{exception.class} #{exception.message}"
143
+ log_debug "Job.process caught [#{exception.class}] #{exception.message}"
144
144
  return oops current_signal, exception
145
145
 
146
146
  else
@@ -214,6 +214,23 @@ module RestFtpDaemon
214
214
  end
215
215
  end
216
216
 
217
+ def set_info level1, level2, value
218
+ @mutex.synchronize do
219
+ @infos || {}
220
+ @infos[level1] ||= {}
221
+
222
+ # Force strings to UTF8
223
+ if value.is_a? Symbol
224
+ @infos[level1][level2] = value.to_s.force_encoding(Encoding::UTF_8)
225
+ elsif value.is_a? String
226
+ @infos[level1][level2] = value.dup.force_encoding(Encoding::UTF_8)
227
+ else
228
+ @infos[level1][level2] = value
229
+ end
230
+ end
231
+ touch_job
232
+ end
233
+
217
234
  protected
218
235
 
219
236
  def alert_common_method_called
@@ -236,8 +253,13 @@ module RestFtpDaemon
236
253
  return unless location.is_a? Location
237
254
  set_info prefix, :uri, location.to_s
238
255
  set_info prefix, :scheme, location.scheme
256
+ set_info prefix, :user, location.user
239
257
  set_info prefix, :host, location.host
258
+ set_info prefix, :port, location.port
240
259
  set_info prefix, :path, location.path
260
+ set_info prefix, :aws_region, location.aws_region
261
+ set_info prefix, :aws_bucket, location.aws_bucket
262
+ set_info prefix, :aws_id, location.aws_id
241
263
  end
242
264
 
243
265
  private
@@ -266,23 +288,6 @@ module RestFtpDaemon
266
288
  touch_job
267
289
  end
268
290
 
269
- def set_info level1, level2, value
270
- @mutex.synchronize do
271
- @infos || {}
272
- @infos[level1] ||= {}
273
-
274
- # Force strings to UTF8
275
- if value.is_a? Symbol
276
- @infos[level1][level2] = value.to_s.force_encoding(Encoding::UTF_8)
277
- elsif value.is_a? String
278
- @infos[level1][level2] = value.dup.force_encoding(Encoding::UTF_8)
279
- else
280
- @infos[level1][level2] = value
281
- end
282
- end
283
- touch_job
284
- end
285
-
286
291
  def utf8 value
287
292
  value.to_s.encode("UTF-8")
288
293
  end
@@ -17,6 +17,7 @@ module RestFtpDaemon
17
17
  target_file_exists: RestFtpDaemon::TargetFileExists,
18
18
  target_directory_error: RestFtpDaemon::TargetDirectoryError,
19
19
  target_permission_error: RestFtpDaemon::TargetPermissionError,
20
+ target_not_supported: RestFtpDaemon::TargetNotSupported,
20
21
  assertion_failed: RestFtpDaemon::AssertionFailed,
21
22
 
22
23
  conn_socket_error: SocketError,
@@ -18,23 +18,28 @@ module RestFtpDaemon
18
18
  # Ensure source is FILE
19
19
  raise RestFtpDaemon::SourceNotSupported, @source_loc.scheme unless source_uri.is_a? URI::FILE
20
20
 
21
- # Prepare remote (case would be preferable but too hard to use,
22
- # as target could be of a descendent class of URI:XXX and not matching directly)
21
+ # Prepare remote object
23
22
  case target_uri
24
23
  when URI::FTP
25
24
  log_info "JobTransfer.before target_method FTP"
26
- @remote = RemoteFTP.new @target_loc.uri, log_prefix, debug: @config[:debug_ftp]
25
+ @remote = RemoteFTP.new @target_loc, log_prefix, @config[:debug_ftps]
27
26
  when URI::FTPES, URI::FTPS
28
27
  log_info "JobTransfer.before target_method FTPES/FTPS"
29
- @remote = RemoteFTP.new @target_loc.uri, log_prefix, debug: @config[:debug_ftps], ftpes: true
28
+ @remote = RemoteFTP.new @target_loc, log_prefix, @config[:debug_ftps], :ftpes
30
29
  when URI::SFTP
31
30
  log_info "JobTransfer.before target_method SFTP"
32
- @remote = RemoteSFTP.new @target_loc.uri, log_prefix, debug: @config[:debug_sftp]
31
+ @remote = RemoteSFTP.new @target_loc, log_prefix, @config[:debug_sftp]
32
+ when URI::S3
33
+ log_info "JobTransfer.before target_method S3"
34
+ @remote = RemoteS3.new @target_loc, log_prefix, @config[:debug_s3]
33
35
  else
34
36
  log_info "JobTransfer.before unknown scheme [#{@target_loc.scheme}]"
35
37
  raise RestFtpDaemon::TargetNotSupported, @target_loc.scheme
36
38
  end
37
39
 
40
+ # Plug this Job into @remote to allow it to log
41
+ @remote.job = self
42
+
38
43
  # rescue URI::InvalidURIError => exception
39
44
  # return oops :started, exception, "target_invalid"
40
45
  end
@@ -84,7 +89,7 @@ module RestFtpDaemon
84
89
  remote_push source, target_final
85
90
 
86
91
  # Add it to transferred target names
87
- targets << target_final.path
92
+ targets << target_final.name
88
93
  set_info :target, :files, targets
89
94
 
90
95
  # Update counters
@@ -4,21 +4,27 @@ require 'active_support/core_ext/module/delegation'
4
4
  module RestFtpDaemon
5
5
  class Location
6
6
  # Accessors
7
+ attr_accessor :name
8
+
7
9
  attr_reader :uri
8
10
  attr_reader :scheme
9
11
  attr_reader :dir
10
- attr_accessor :name
12
+
13
+
14
+ attr_reader :aws_region
15
+ attr_reader :aws_bucket
16
+ attr_reader :aws_id
17
+ attr_reader :aws_secret
11
18
 
12
19
  # Logging
13
20
  #attr_reader :logger
14
21
  #include BmcDaemonLib::LoggerHelper
15
22
 
16
23
  # def_delegators :@uri,
17
- delegate :scheme, :host, :user, :password, :to_s, to: :uri
24
+ delegate :scheme, :host, :port, :user, :password, :to_s,
25
+ to: :uri
18
26
 
19
27
  def initialize path
20
- #@logger = BmcDaemonLib::LoggerPool.instance.get :transfer
21
- #log_debug "Location.initialize path[#{path}]"
22
28
  # Strip spaces before/after, copying original "path" at the same time
23
29
  location_uri = path.strip
24
30
 
@@ -27,12 +33,16 @@ module RestFtpDaemon
27
33
  fix_scheme! location_uri
28
34
 
29
35
  # Parse URL
30
- #log_debug "Location.initialize uri[#{location_uri}]"
31
36
  parse_url location_uri
32
37
 
38
+ # Match AWS URL with BUCKET.s3.amazonaws.com
39
+ init_aws if @uri.is_a? URI::S3
40
+
41
+ # Set default user if not provided
42
+ init_username
43
+
33
44
  # Ensure result does not contain tokens after replacement
34
45
  detected_tokens = detect_tokens(location_uri)
35
- #log_debug "Location.initialize detected_tokens: #{detected_tokens.inspect}"
36
46
  unless detected_tokens.empty?
37
47
  raise RestFtpDaemon::UnresolvedTokens, detected_tokens.join(' ')
38
48
  end
@@ -41,13 +51,6 @@ module RestFtpDaemon
41
51
  unless @uri.scheme
42
52
  raise RestFtpDaemon::UnsupportedScheme, url
43
53
  end
44
-
45
- # All done
46
- #log_debug "Location.initialize class[#{@uri.class}] scheme[#{@uri.scheme}] dir[#{@dir}] name[#{@name}]"
47
- end
48
-
49
- def is? klass
50
- @uri.is_a? klass
51
54
  end
52
55
 
53
56
  def path
@@ -88,7 +91,7 @@ module RestFtpDaemon
88
91
 
89
92
  # Replace endpoints defined in config
90
93
  vectors.each do |from, to|
91
- next if to.to_s.blank?
94
+ next if to.to_s.empty?
92
95
  path.gsub! tokenize(from), to
93
96
  end
94
97
  end
@@ -105,10 +108,9 @@ module RestFtpDaemon
105
108
  def parse_url path
106
109
  # Parse that URL
107
110
  @uri = URI.parse path # rescue nil
108
- raise RestFtpDaemon::LocationParseError, location_path unless uri
111
+ raise RestFtpDaemon::LocationParseError, location_path unless @uri
109
112
 
110
113
  # Store URL parts
111
- # remove_multiple_slashes
112
114
  @ori_path = path
113
115
  @uri_path = uri.path
114
116
  @dir = extract_dirname uri.path
@@ -118,6 +120,26 @@ module RestFtpDaemon
118
120
  raise RestFtpDaemon::LocationParseError, exception.message unless uri
119
121
  end
120
122
 
123
+ def init_username
124
+ @uri.user ||= "anonymous"
125
+ end
126
+
127
+ def init_aws
128
+ # Split hostname
129
+ parts = @uri.host.split('.')
130
+
131
+ # Pop parts
132
+ aws_tld = parts.pop
133
+ aws_domain = parts.pop
134
+ @aws_region = parts.pop
135
+ aws_tag = parts.pop
136
+ @aws_bucket = parts.pop
137
+
138
+ # Credentials from config
139
+ @aws_id = Conf.at(:credentials, @uri.host, :id)
140
+ @aws_secret = Conf.at(:credentials, @uri.host, :secret)
141
+ end
142
+
121
143
  def extract_filename path
122
144
  # match everything that's after a slash at the end of the string
123
145
  m = path.match(/\/?([^\/]+)$/)
@@ -0,0 +1,5 @@
1
+ module PrettyJSON
2
+ def self.call(object, env)
3
+ JSON.pretty_generate(JSON.parse(object.to_json))
4
+ end
5
+ end
@@ -7,20 +7,33 @@ module RestFtpDaemon
7
7
  attr_reader :logger
8
8
  attr_reader :log_prefix
9
9
 
10
- def initialize url, log_prefix, options = {}
11
- # Options
12
- @debug = !!options[:debug]
10
+ attr_accessor :job
11
+
12
+ # Delegate set_info info to Job
13
+ delegate :set_info, to: :job
14
+
15
+ def initialize target, log_prefix, debug = false, ftpes = false
16
+ # Init
17
+ @target = target
18
+ @ftpes = ftpes
19
+ @debug = debug
20
+
21
+ # Build and empty job to protect set_info delegation
22
+ @job = Job.new(nil, {})
13
23
 
14
24
  # Logger
15
25
  @log_prefix = log_prefix || {}
16
26
  @logger = BmcDaemonLib::LoggerPool.instance.get :transfer
17
27
 
18
- # Extract URL parts
19
- @url = url
20
- @url.user ||= "anonymous"
21
-
22
28
  # Annnounce object
23
- log_info "Remote.initialize [#{url}]"
29
+ log_info "Remote.initialize [#{target.path}]"
30
+ log_debug "Remote.initialize target[#{@target.inspect}]"
31
+
32
+ # Prepare real object
33
+ prepare
34
+ end
35
+
36
+ def prepare
24
37
  end
25
38
 
26
39
  def connect
@@ -29,12 +42,16 @@ module RestFtpDaemon
29
42
  puts
30
43
  puts "-------------------- SESSION STARTING -------------------------"
31
44
  puts "class\t #{myname}"
32
- puts "host\t #{@url.host}"
33
- puts "user\t #{@url.user}"
34
- puts "port\t #{@url.port}"
35
- puts "options\t #{@options.inspect}"
45
+ puts "host\t #{@target.host}"
46
+ puts "user\t #{@target.user}"
47
+ puts "port\t #{@target.port}"
36
48
  puts "---------------------------------------------------------------"
49
+ end
50
+
51
+ def chdir_or_create directory, mkdir = false
52
+ end
37
53
 
54
+ def remove! target
38
55
  end
39
56
 
40
57
  def close
@@ -8,12 +8,9 @@ module RestFtpDaemon
8
8
  # Class options
9
9
  attr_reader :ftp
10
10
 
11
- def initialize url, log_prefix, options = {}
12
- # Call super
13
- super
14
-
11
+ def prepare
15
12
  # Create FTP object
16
- if options[:ftpes]
13
+ if @ftpes
17
14
  prepare_ftpes
18
15
  else
19
16
  prepare_ftp
@@ -25,14 +22,14 @@ module RestFtpDaemon
25
22
  @chunk_size = DEFAULT_FTP_CHUNK.to_i * 1024
26
23
 
27
24
  # Announce object
28
- log_debug "RemoteFTP.initialize chunk_size:#{@chunk_size}"
25
+ log_debug "RemoteFTP.prepare chunk_size:#{@chunk_size}"
29
26
  end
30
27
 
31
28
  def connect
32
29
  # Connect remote server
33
30
  super
34
- @ftp.connect @url.host, @url.port
35
- @ftp.login @url.user, @url.password
31
+ @ftp.connect @target.host, @target.port
32
+ @ftp.login @target.user, @target.password
36
33
  end
37
34
 
38
35
  def present? target
@@ -88,7 +85,7 @@ module RestFtpDaemon
88
85
 
89
86
  def push source, target, tempname = nil, &callback
90
87
  # Push init
91
- raise RestFtpDaemon::AssertionFailed, "push/1" if @ftp.nil?
88
+ raise RestFtpDaemon::AssertionFailed, "push/ftp" if @ftp.nil?
92
89
 
93
90
  # Temp file if provided
94
91
  destination = target.clone
@@ -0,0 +1,52 @@
1
+ require 'aws-sdk-resources'
2
+
3
+ # Handle sFTP transfers for Remote class
4
+ module RestFtpDaemon
5
+ class RemoteS3 < Remote
6
+
7
+ # Class options
8
+ attr_reader :client
9
+ attr_reader :target
10
+
11
+ def prepare
12
+ log_debug "RemoteS3.prepare target[#{@target.inspect}]"
13
+ end
14
+
15
+ def connect
16
+ # Connect init
17
+ super
18
+ log_debug "RemoteS3.connect [#{@target.aws_id}]@[#{@target.aws_bucket}]"
19
+
20
+ # Debug level
21
+ verbosity = @debug ? Logger::DEBUG : false
22
+
23
+ # Connect remote server
24
+ @client = Aws::S3::Resource.new(
25
+ region: @target.aws_region,
26
+ credentials: Aws::Credentials.new(@target.aws_id, @target.aws_secret)
27
+ )
28
+ end
29
+
30
+ def push source, target, tempname = nil, &callback
31
+ # Push init
32
+ raise RestFtpDaemon::AssertionFailed, "push/client" if @client.nil?
33
+ log_debug "RemoteS3.push bucket[#{target.aws_bucket}] name[#{target.name}]"
34
+
35
+ # Do the transfer
36
+ bucket = @client.bucket(target.aws_bucket)
37
+ object = bucket.object(target.name)
38
+ object.put(body:'Hello World!')
39
+
40
+ # Dump information about this file
41
+ log_debug "RemoteS3.push url[#{object.public_url}]"
42
+ log_debug "RemoteS3.push etag[#{object.etag}]"
43
+ set_info :target, :aws_public_url, object.public_url
44
+ set_info :target, :aws_etag, object.etag
45
+ end
46
+
47
+ def connected?
48
+ !@client.nil?
49
+ end
50
+
51
+ end
52
+ end
@@ -7,27 +7,22 @@ module RestFtpDaemon
7
7
  # Class options
8
8
  attr_reader :sftp
9
9
 
10
- def initialize url, log_prefix, options = {}
11
- # Call super
12
- super
13
-
14
- # Announce object
15
- log_debug "RemoteSFTP.initialize"
10
+ def prepare
16
11
  end
17
12
 
18
13
  def connect
19
14
  # Connect init
20
15
  super
21
- log_debug "RemoteSFTP.connect [#{@url.user}]@[#{@url.host}]:[#{@url.port}]"
16
+ log_debug "RemoteSFTP.connect [#{@target.user}]@[#{@target.host}]:[#{@target.port}]"
22
17
 
23
18
  # Debug level
24
19
  verbosity = @debug ? Logger::DEBUG : false
25
20
 
26
21
  # Connect remote server
27
- @sftp = Net::SFTP.start(@url.host.to_s, @url.user.to_s,
28
- password: @url.password.to_s,
22
+ @sftp = Net::SFTP.start(@target.host.to_s, @target.user.to_s,
23
+ password: @target.password.to_s,
29
24
  verbose: verbosity,
30
- port: @url.port,
25
+ port: @target.port,
31
26
  non_interactive: true,
32
27
  timeout: DEFAULT_SFTP_TIMEOUT
33
28
  )
@@ -93,7 +88,7 @@ module RestFtpDaemon
93
88
 
94
89
  def push source, target, tempname = nil, &callback
95
90
  # Push init
96
- raise RestFtpDaemon::AssertionFailed, "push/1" if @sftp.nil?
91
+ raise RestFtpDaemon::AssertionFailed, "push/sftp" if @sftp.nil?
97
92
 
98
93
  # Temp file if provided
99
94
  destination = target.clone
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  # Project version
5
- spec.version = "0.410.5"
5
+ spec.version = "0.420.1"
6
6
 
7
7
  # Project description
8
8
  spec.name = "rest-ftp-daemon"
@@ -56,6 +56,7 @@ Gem::Specification.new do |spec|
56
56
 
57
57
  spec.add_runtime_dependency "net-sftp"
58
58
  spec.add_runtime_dependency "double-bag-ftps"
59
+ spec.add_runtime_dependency "aws-sdk-resources", '~> 2'
59
60
 
60
61
  spec.add_runtime_dependency "streamio-ffmpeg"
61
62
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-ftp-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.410.5
4
+ version: 0.420.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
@@ -360,6 +360,20 @@ dependencies:
360
360
  - - ">="
361
361
  - !ruby/object:Gem::Version
362
362
  version: '0'
363
+ - !ruby/object:Gem::Dependency
364
+ name: aws-sdk-resources
365
+ requirement: !ruby/object:Gem::Requirement
366
+ requirements:
367
+ - - "~>"
368
+ - !ruby/object:Gem::Version
369
+ version: '2'
370
+ type: :runtime
371
+ prerelease: false
372
+ version_requirements: !ruby/object:Gem::Requirement
373
+ requirements:
374
+ - - "~>"
375
+ - !ruby/object:Gem::Version
376
+ version: '2'
363
377
  - !ruby/object:Gem::Dependency
364
378
  name: streamio-ffmpeg
365
379
  requirement: !ruby/object:Gem::Requirement
@@ -422,8 +436,10 @@ files:
422
436
  - lib/rest-ftp-daemon/metrics.rb
423
437
  - lib/rest-ftp-daemon/notification.rb
424
438
  - lib/rest-ftp-daemon/paginate.rb
439
+ - lib/rest-ftp-daemon/pretty_json.rb
425
440
  - lib/rest-ftp-daemon/remote.rb
426
441
  - lib/rest-ftp-daemon/remote_ftp.rb
442
+ - lib/rest-ftp-daemon/remote_s3.rb
427
443
  - lib/rest-ftp-daemon/remote_sftp.rb
428
444
  - lib/rest-ftp-daemon/static/config.json
429
445
  - lib/rest-ftp-daemon/static/css/bootstrap.min.css