backup 3.0.27 → 3.1.0

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.
Files changed (166) hide show
  1. data/LICENSE.md +1 -1
  2. data/README.md +139 -386
  3. data/bin/backup +1 -7
  4. data/lib/backup.rb +3 -9
  5. data/lib/backup/archive.rb +26 -20
  6. data/lib/backup/cleaner.rb +2 -2
  7. data/lib/backup/cli.rb +366 -0
  8. data/lib/backup/compressor/base.rb +2 -2
  9. data/lib/backup/compressor/gzip.rb +35 -1
  10. data/lib/backup/config.rb +1 -2
  11. data/lib/backup/database/base.rb +2 -2
  12. data/lib/backup/database/mongodb.rb +3 -3
  13. data/lib/backup/database/mysql.rb +3 -2
  14. data/lib/backup/database/postgresql.rb +3 -2
  15. data/lib/backup/database/riak.rb +18 -5
  16. data/lib/backup/dependency.rb +144 -93
  17. data/lib/backup/encryptor/base.rb +2 -2
  18. data/lib/backup/logger.rb +108 -110
  19. data/lib/backup/logger/console.rb +51 -0
  20. data/lib/backup/logger/logfile.rb +113 -0
  21. data/lib/backup/logger/syslog.rb +116 -0
  22. data/lib/backup/model.rb +67 -65
  23. data/lib/backup/notifier/base.rb +1 -1
  24. data/lib/backup/notifier/hipchat.rb +1 -1
  25. data/lib/backup/notifier/mail.rb +1 -1
  26. data/lib/backup/notifier/pushover.rb +6 -3
  27. data/lib/backup/packager.rb +4 -4
  28. data/lib/backup/pipeline.rb +17 -3
  29. data/lib/backup/splitter.rb +2 -2
  30. data/lib/backup/storage/base.rb +2 -2
  31. data/lib/backup/storage/cloudfiles.rb +2 -2
  32. data/lib/backup/storage/dropbox.rb +4 -4
  33. data/lib/backup/storage/ftp.rb +2 -2
  34. data/lib/backup/storage/local.rb +2 -2
  35. data/lib/backup/storage/ninefold.rb +2 -2
  36. data/lib/backup/storage/rsync.rb +3 -3
  37. data/lib/backup/storage/s3.rb +2 -2
  38. data/lib/backup/storage/scp.rb +2 -6
  39. data/lib/backup/storage/sftp.rb +2 -5
  40. data/lib/backup/syncer/base.rb +1 -1
  41. data/lib/backup/syncer/cloud/base.rb +15 -8
  42. data/lib/backup/syncer/rsync/local.rb +1 -1
  43. data/lib/backup/syncer/rsync/pull.rb +1 -1
  44. data/lib/backup/syncer/rsync/push.rb +1 -1
  45. data/lib/backup/utilities.rb +211 -0
  46. data/lib/backup/version.rb +1 -1
  47. data/templates/cli/{utility/archive → archive} +4 -8
  48. data/templates/cli/{utility/compressor → compressor}/bzip2 +0 -0
  49. data/templates/cli/{utility/compressor → compressor}/custom +0 -0
  50. data/templates/cli/{utility/compressor → compressor}/gzip +0 -0
  51. data/templates/cli/{utility/compressor → compressor}/lzma +0 -0
  52. data/templates/cli/{utility/compressor → compressor}/pbzip2 +0 -0
  53. data/templates/cli/config +68 -0
  54. data/templates/cli/{utility/database → database}/mongodb +1 -1
  55. data/templates/cli/{utility/database → database}/mysql +1 -1
  56. data/templates/cli/{utility/database → database}/postgresql +1 -1
  57. data/templates/cli/{utility/database → database}/redis +0 -0
  58. data/templates/cli/database/riak +20 -0
  59. data/templates/cli/{utility/encryptor → encryptor}/gpg +0 -0
  60. data/templates/cli/{utility/encryptor → encryptor}/openssl +0 -0
  61. data/templates/cli/{utility/model.erb → model.erb} +4 -4
  62. data/templates/cli/{utility/notifier → notifier}/campfire +0 -0
  63. data/templates/cli/{utility/notifier → notifier}/hipchat +0 -0
  64. data/templates/cli/{utility/notifier → notifier}/mail +0 -0
  65. data/templates/cli/{utility/notifier → notifier}/prowl +0 -0
  66. data/templates/cli/{utility/notifier → notifier}/pushover +0 -0
  67. data/templates/cli/{utility/notifier → notifier}/twitter +0 -0
  68. data/templates/cli/{utility/splitter → splitter} +0 -0
  69. data/templates/cli/{utility/storage → storage}/cloud_files +0 -0
  70. data/templates/cli/{utility/storage → storage}/dropbox +0 -0
  71. data/templates/cli/{utility/storage → storage}/ftp +0 -0
  72. data/templates/cli/{utility/storage → storage}/local +0 -0
  73. data/templates/cli/{utility/storage → storage}/ninefold +0 -0
  74. data/templates/cli/{utility/storage → storage}/rsync +0 -0
  75. data/templates/cli/{utility/storage → storage}/s3 +0 -0
  76. data/templates/cli/{utility/storage → storage}/scp +0 -0
  77. data/templates/cli/{utility/storage → storage}/sftp +0 -0
  78. data/templates/cli/{utility/syncer → syncer}/cloud_files +0 -0
  79. data/templates/cli/{utility/syncer → syncer}/rsync_local +0 -0
  80. data/templates/cli/{utility/syncer → syncer}/rsync_pull +0 -0
  81. data/templates/cli/{utility/syncer → syncer}/rsync_push +0 -0
  82. data/templates/cli/{utility/syncer → syncer}/s3 +0 -0
  83. metadata +55 -131
  84. data/.gitignore +0 -8
  85. data/.travis.yml +0 -10
  86. data/Gemfile +0 -28
  87. data/Guardfile +0 -23
  88. data/backup.gemspec +0 -32
  89. data/lib/backup/cli/helpers.rb +0 -93
  90. data/lib/backup/cli/utility.rb +0 -255
  91. data/spec-live/.gitignore +0 -6
  92. data/spec-live/README +0 -7
  93. data/spec-live/backups/config.rb +0 -83
  94. data/spec-live/backups/config.yml.template +0 -46
  95. data/spec-live/backups/models.rb +0 -184
  96. data/spec-live/compressor/custom_spec.rb +0 -30
  97. data/spec-live/compressor/gzip_spec.rb +0 -30
  98. data/spec-live/encryptor/gpg_keys.rb +0 -239
  99. data/spec-live/encryptor/gpg_spec.rb +0 -287
  100. data/spec-live/notifier/mail_spec.rb +0 -121
  101. data/spec-live/spec_helper.rb +0 -151
  102. data/spec-live/storage/dropbox_spec.rb +0 -151
  103. data/spec-live/storage/local_spec.rb +0 -83
  104. data/spec-live/storage/scp_spec.rb +0 -193
  105. data/spec-live/syncer/cloud/s3_spec.rb +0 -124
  106. data/spec/archive_spec.rb +0 -335
  107. data/spec/cleaner_spec.rb +0 -312
  108. data/spec/cli/helpers_spec.rb +0 -301
  109. data/spec/cli/utility_spec.rb +0 -411
  110. data/spec/compressor/base_spec.rb +0 -52
  111. data/spec/compressor/bzip2_spec.rb +0 -217
  112. data/spec/compressor/custom_spec.rb +0 -106
  113. data/spec/compressor/gzip_spec.rb +0 -217
  114. data/spec/compressor/lzma_spec.rb +0 -123
  115. data/spec/compressor/pbzip2_spec.rb +0 -165
  116. data/spec/config_spec.rb +0 -321
  117. data/spec/configuration/helpers_spec.rb +0 -247
  118. data/spec/configuration/store_spec.rb +0 -39
  119. data/spec/configuration_spec.rb +0 -62
  120. data/spec/database/base_spec.rb +0 -63
  121. data/spec/database/mongodb_spec.rb +0 -510
  122. data/spec/database/mysql_spec.rb +0 -411
  123. data/spec/database/postgresql_spec.rb +0 -353
  124. data/spec/database/redis_spec.rb +0 -334
  125. data/spec/database/riak_spec.rb +0 -176
  126. data/spec/dependency_spec.rb +0 -51
  127. data/spec/encryptor/base_spec.rb +0 -40
  128. data/spec/encryptor/gpg_spec.rb +0 -909
  129. data/spec/encryptor/open_ssl_spec.rb +0 -148
  130. data/spec/errors_spec.rb +0 -306
  131. data/spec/logger_spec.rb +0 -367
  132. data/spec/model_spec.rb +0 -666
  133. data/spec/notifier/base_spec.rb +0 -104
  134. data/spec/notifier/campfire_spec.rb +0 -217
  135. data/spec/notifier/hipchat_spec.rb +0 -211
  136. data/spec/notifier/mail_spec.rb +0 -316
  137. data/spec/notifier/prowl_spec.rb +0 -138
  138. data/spec/notifier/pushover_spec.rb +0 -123
  139. data/spec/notifier/twitter_spec.rb +0 -153
  140. data/spec/package_spec.rb +0 -61
  141. data/spec/packager_spec.rb +0 -213
  142. data/spec/pipeline_spec.rb +0 -259
  143. data/spec/spec_helper.rb +0 -60
  144. data/spec/splitter_spec.rb +0 -120
  145. data/spec/storage/base_spec.rb +0 -166
  146. data/spec/storage/cloudfiles_spec.rb +0 -254
  147. data/spec/storage/cycler_spec.rb +0 -247
  148. data/spec/storage/dropbox_spec.rb +0 -480
  149. data/spec/storage/ftp_spec.rb +0 -271
  150. data/spec/storage/local_spec.rb +0 -259
  151. data/spec/storage/ninefold_spec.rb +0 -343
  152. data/spec/storage/rsync_spec.rb +0 -362
  153. data/spec/storage/s3_spec.rb +0 -245
  154. data/spec/storage/scp_spec.rb +0 -233
  155. data/spec/storage/sftp_spec.rb +0 -244
  156. data/spec/syncer/base_spec.rb +0 -109
  157. data/spec/syncer/cloud/base_spec.rb +0 -515
  158. data/spec/syncer/cloud/cloud_files_spec.rb +0 -181
  159. data/spec/syncer/cloud/s3_spec.rb +0 -174
  160. data/spec/syncer/rsync/base_spec.rb +0 -98
  161. data/spec/syncer/rsync/local_spec.rb +0 -149
  162. data/spec/syncer/rsync/pull_spec.rb +0 -98
  163. data/spec/syncer/rsync/push_spec.rb +0 -333
  164. data/spec/version_spec.rb +0 -21
  165. data/templates/cli/utility/config +0 -32
  166. data/templates/cli/utility/database/riak +0 -11
data/lib/backup/model.rb CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  module Backup
4
4
  class Model
5
- include Backup::CLI::Helpers
6
-
7
5
  class << self
8
6
  ##
9
7
  # The Backup::Model.all class method keeps track of all the models
@@ -14,23 +12,14 @@ module Backup
14
12
  end
15
13
 
16
14
  ##
17
- # Return the first model matching +trigger+.
18
- # Raises Errors::MissingTriggerError if no matches are found.
19
- def find(trigger)
20
- trigger = trigger.to_s
21
- all.each do |model|
22
- return model if model.trigger == trigger
15
+ # Return an Array of Models matching the given +trigger+.
16
+ def find_by_trigger(trigger)
17
+ if trigger.include?('*')
18
+ regex = /^#{ trigger.to_s.gsub('*', '(.*)') }$/
19
+ all.select {|model| regex =~ model.trigger }
20
+ else
21
+ all.select {|model| trigger == model.trigger }
23
22
  end
24
- raise Errors::Model::MissingTriggerError,
25
- "Could not find trigger '#{trigger}'."
26
- end
27
-
28
- ##
29
- # Find and return an Array of all models matching +trigger+
30
- # Used to match triggers using a wildcard (*)
31
- def find_matching(trigger)
32
- regex = /^#{ trigger.to_s.gsub('*', '(.*)') }$/
33
- all.select {|model| regex =~ model.trigger }
34
23
  end
35
24
  end
36
25
 
@@ -183,18 +172,6 @@ module Backup
183
172
  end
184
173
  end
185
174
 
186
- ##
187
- # Ensure DATA_PATH and DATA_PATH/TRIGGER are created
188
- # if they do not yet exist
189
- #
190
- # Clean any temporary files and/or package files left over
191
- # from the last time this model/trigger was performed.
192
- # Logs warnings if files exist and are cleaned.
193
- def prepare!
194
- FileUtils.mkdir_p(File.join(Config.data_path, trigger))
195
- Cleaner.prepare(self)
196
- end
197
-
198
175
  ##
199
176
  # Performs the backup process
200
177
  ##
@@ -248,6 +225,8 @@ module Backup
248
225
  @time = @started_at.strftime("%Y.%m.%d.%H.%M.%S")
249
226
  log!(:started)
250
227
 
228
+ prepare!
229
+
251
230
  if databases.any? or archives.any?
252
231
  procedures.each do |procedure|
253
232
  (procedure.call; next) if procedure.is_a?(Proc)
@@ -260,41 +239,25 @@ module Backup
260
239
  log!(:finished)
261
240
 
262
241
  rescue Exception => err
263
- fatal = !err.is_a?(StandardError)
264
-
265
- err = Errors::ModelError.wrap(err, <<-EOS)
266
- Backup for #{label} (#{trigger}) Failed!
267
- An Error occured which has caused this Backup to abort before completion.
268
- EOS
269
- Logger.error err
270
- Logger.error "\nBacktrace:\n\s\s" + err.backtrace.join("\n\s\s") + "\n\n"
271
-
272
- Cleaner.warnings(self)
273
-
274
- if fatal
275
- Logger.error Errors::ModelError.new(<<-EOS)
276
- This Error was Fatal and Backup will now exit.
277
- If you have other Backup jobs (triggers) configured to run,
278
- they will not be processed.
279
- EOS
280
- else
281
- Logger.message Errors::ModelError.new(<<-EOS)
282
- If you have other Backup jobs (triggers) configured to run,
283
- Backup will now attempt to continue...
284
- EOS
285
- end
286
-
287
- notifiers.each do |n|
288
- begin
289
- n.perform!(true)
290
- rescue Exception; end
291
- end
292
-
293
- exit(1) if fatal
242
+ log!(:failure, err)
243
+ send_failure_notifications
244
+ exit(1) unless err.is_a?(StandardError)
294
245
  end
295
246
 
296
247
  private
297
248
 
249
+ ##
250
+ # Ensure DATA_PATH and DATA_PATH/TRIGGER are created
251
+ # if they do not yet exist
252
+ #
253
+ # Clean any temporary files and/or package files left over
254
+ # from the last time this model/trigger was performed.
255
+ # Logs warnings if files exist and are cleaned.
256
+ def prepare!
257
+ FileUtils.mkdir_p(File.join(Config.data_path, trigger))
258
+ Cleaner.prepare(self)
259
+ end
260
+
298
261
  ##
299
262
  # After all the databases and archives have been dumped and sorted,
300
263
  # these files will be bundled in to a .tar archive (uncompressed),
@@ -352,11 +315,11 @@ module Backup
352
315
  end
353
316
 
354
317
  ##
355
- # Logs messages when the backup starts and finishes
356
- def log!(action)
318
+ # Logs messages when the backup starts, finishes or fails
319
+ def log!(action, exception = nil)
357
320
  case action
358
321
  when :started
359
- Logger.message "Performing Backup for '#{label} (#{trigger})'!\n" +
322
+ Logger.info "Performing Backup for '#{label} (#{trigger})'!\n" +
360
323
  "[ backup #{ Version.current } : #{ RUBY_DESCRIPTION } ]"
361
324
 
362
325
  when :finished
@@ -365,7 +328,30 @@ module Backup
365
328
  if Logger.has_warnings?
366
329
  Logger.warn msg % 'Successfully (with Warnings)'
367
330
  else
368
- Logger.message msg % 'Successfully'
331
+ Logger.info msg % 'Successfully'
332
+ end
333
+
334
+ when :failure
335
+ err = Errors::ModelError.wrap(exception, <<-EOS)
336
+ Backup for #{label} (#{trigger}) Failed!
337
+ An Error occured which has caused this Backup to abort before completion.
338
+ EOS
339
+ Logger.error err
340
+ Logger.error "\nBacktrace:\n\s\s" + err.backtrace.join("\n\s\s") + "\n\n"
341
+
342
+ Cleaner.warnings(self)
343
+
344
+ if exception.is_a?(StandardError)
345
+ Logger.info Errors::ModelError.new(<<-EOS)
346
+ If you have other Backup jobs (triggers) configured to run,
347
+ Backup will now attempt to continue...
348
+ EOS
349
+ else
350
+ Logger.error Errors::ModelError.new(<<-EOS)
351
+ This Error was Fatal and Backup will now exit.
352
+ If you have other Backup jobs (triggers) configured to run,
353
+ they will not be processed.
354
+ EOS
369
355
  end
370
356
  end
371
357
  end
@@ -381,5 +367,21 @@ module Backup
381
367
  '%02d:%02d:%02d' % [hours, minutes, seconds]
382
368
  end
383
369
 
370
+ ##
371
+ # Sends notifications when a backup fails.
372
+ # Errors are logged and rescued, since the error that caused the
373
+ # backup to fail could have been an error with a notifier.
374
+ def send_failure_notifications
375
+ notifiers.each do |n|
376
+ begin
377
+ n.perform!(true)
378
+ rescue Exception => err
379
+ Logger.error Errors::ModelError.wrap(err, <<-EOS)
380
+ #{ n.class } Failed to send notification of backup failure.
381
+ EOS
382
+ end
383
+ end
384
+ end
385
+
384
386
  end
385
387
  end
@@ -73,7 +73,7 @@ module Backup
73
73
  # Logs a message to the console and log file to inform
74
74
  # the client that Backup is notifying about the process
75
75
  def log!
76
- Logger.message "#{ notifier_name } started notifying about the process."
76
+ Logger.info "#{ notifier_name } started notifying about the process."
77
77
  end
78
78
 
79
79
  end
@@ -83,7 +83,7 @@ module Backup
83
83
 
84
84
  def send_message(msg, color)
85
85
  client = HipChat::Client.new(token)
86
- [rooms_notified].flatten.each do |room|
86
+ Array(rooms_notified).map {|r| r.split(',').map(&:strip) }.flatten.each do |room|
87
87
  client[room].send(from, msg, :color => color, :notify => notify_users)
88
88
  end
89
89
  end
@@ -150,7 +150,7 @@ module Backup
150
150
  email.convert_to_multipart
151
151
  email.attachments["#{@model.time}.#{@model.trigger}.log"] = {
152
152
  :mime_type => 'text/plain;',
153
- :content => Logger.messages.join("\n")
153
+ :content => Logger.messages.map(&:formatted_lines).flatten.join("\n")
154
154
  }
155
155
  end
156
156
 
@@ -14,7 +14,8 @@ module Backup
14
14
  attr_accessor :token
15
15
 
16
16
  ##
17
- # The user's device identifier to sent he message directly to that device rather than all of the user's devices
17
+ # The user's device identifier to sent the message directly to,
18
+ # rather than all of the user's devices
18
19
  attr_accessor :device
19
20
 
20
21
  ##
@@ -68,7 +69,7 @@ module Backup
68
69
  url = URI.parse("https://api.pushover.net/1/messages.json")
69
70
 
70
71
  request = Net::HTTP::Post.new(url.path)
71
- request.set_form_data(parameters.merge ({:message => message}))
72
+ request.set_form_data(parameters.merge({:message => message}))
72
73
  response = Net::HTTP.new(url.host, url.port)
73
74
 
74
75
  response.use_ssl = true
@@ -80,7 +81,9 @@ module Backup
80
81
  # List available parameters
81
82
  def parameters
82
83
  @values = {}
83
- [:token, :user, :message, :title, :priority, :device].each { |k| @values.merge! k => self.instance_variable_get("@#{k}") }
84
+ [:token, :user, :message, :title, :priority, :device].each do |k|
85
+ @values.merge! k => self.instance_variable_get("@#{k}")
86
+ end
84
87
  @values
85
88
  end
86
89
  end
@@ -3,7 +3,7 @@
3
3
  module Backup
4
4
  module Packager
5
5
  class << self
6
- include Backup::CLI::Helpers
6
+ include Backup::Utilities::Helpers
7
7
 
8
8
  ##
9
9
  # Build the final package for the backup model.
@@ -13,11 +13,11 @@ module Backup
13
13
  @splitter = model.splitter
14
14
  @pipeline = Pipeline.new
15
15
 
16
- Logger.message "Packaging the backup files..."
16
+ Logger.info "Packaging the backup files..."
17
17
  procedure.call
18
18
 
19
19
  if @pipeline.success?
20
- Logger.message "Packaging Complete!"
20
+ Logger.info "Packaging Complete!"
21
21
  else
22
22
  raise Errors::Packager::PipelineError,
23
23
  "Failed to Create Backup Package\n" +
@@ -81,7 +81,7 @@ module Backup
81
81
  else
82
82
  stack << lambda do
83
83
  outfile = File.join(Config.tmp_path, @package.basename)
84
- @pipeline << "cat > #{ outfile }"
84
+ @pipeline << "#{ utility(:cat) } > #{ outfile }"
85
85
  stack.shift.call
86
86
  end
87
87
  end
@@ -2,12 +2,13 @@
2
2
 
3
3
  module Backup
4
4
  class Pipeline
5
- include Backup::CLI::Helpers
5
+ include Backup::Utilities::Helpers
6
6
 
7
7
  attr_reader :stderr, :errors
8
8
 
9
9
  def initialize
10
10
  @commands = []
11
+ @success_codes = []
11
12
  @errors = []
12
13
  @stderr = ''
13
14
  end
@@ -16,8 +17,21 @@ module Backup
16
17
  # Adds a command to be executed in the pipeline.
17
18
  # Each command will be run in the order in which it was added,
18
19
  # with it's output being piped to the next command.
19
- def <<(command)
20
+ #
21
+ # +success_codes+ must be an Array of Integer exit codes that will
22
+ # be considered successful for the +command+.
23
+ def add(command, success_codes)
20
24
  @commands << command
25
+ @success_codes << success_codes
26
+ end
27
+
28
+ ##
29
+ # Commands added using this method will only be considered successful
30
+ # if their exit status is 0.
31
+ #
32
+ # Use #add if successful exit status codes need to be specified.
33
+ def <<(command)
34
+ add(command, [0])
21
35
  end
22
36
 
23
37
  ##
@@ -39,7 +53,7 @@ module Backup
39
53
  pipestatus = stdout.read.gsub("\n", '').split(':').sort
40
54
  pipestatus.each do |status|
41
55
  index, exitstatus = status.split('|').map(&:to_i)
42
- if exitstatus > 0
56
+ unless @success_codes[index].include?(exitstatus)
43
57
  command = command_name(@commands[index])
44
58
  @errors << SystemCallError.new(
45
59
  "'#{ command }' returned exit code: #{ exitstatus }", exitstatus
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Backup
4
4
  class Splitter
5
- include Backup::CLI::Helpers
5
+ include Backup::Utilities::Helpers
6
6
 
7
7
  def initialize(model, chunk_size)
8
8
  @model = model
@@ -32,7 +32,7 @@ module Backup
32
32
  # be suffixed using 'aa', 'ab', and so on... for each file.
33
33
  def before_packaging
34
34
  @package = @model.package
35
- Logger.message "Splitter configured with a chunk size of " +
35
+ Logger.info "Splitter configured with a chunk size of " +
36
36
  "#{ @chunk_size }MB."
37
37
 
38
38
  @split_command = "#{ utility(:split) } -b #{ @chunk_size }m - " +
@@ -89,9 +89,9 @@ module Backup
89
89
  # containing the original error message.
90
90
  def cycle!
91
91
  return unless keep.to_i > 0
92
- Logger.message "#{ storage_name }: Cycling Started..."
92
+ Logger.info "#{ storage_name }: Cycling Started..."
93
93
  Cycler.cycle!(self, @package)
94
- Logger.message "#{ storage_name }: Cycling Complete!"
94
+ Logger.info "#{ storage_name }: Cycling Complete!"
95
95
  end
96
96
 
97
97
  end
@@ -58,7 +58,7 @@ module Backup
58
58
  remote_path = remote_path_for(@package)
59
59
 
60
60
  files_to_transfer_for(@package) do |local_file, remote_file|
61
- Logger.message "#{storage_name} started transferring '#{ local_file }'."
61
+ Logger.info "#{storage_name} started transferring '#{ local_file }'."
62
62
 
63
63
  File.open(File.join(local_path, local_file), 'r') do |file|
64
64
  connection.put_object(
@@ -76,7 +76,7 @@ module Backup
76
76
  remote_path = remote_path_for(package)
77
77
 
78
78
  transferred_files_for(package) do |local_file, remote_file|
79
- Logger.message "#{storage_name} started removing '#{ local_file }' " +
79
+ Logger.info "#{storage_name} started removing '#{ local_file }' " +
80
80
  "from container '#{ container }'."
81
81
  connection.delete_object(container, File.join(remote_path, remote_file))
82
82
  end
@@ -55,7 +55,7 @@ module Backup
55
55
  return @connection if @connection
56
56
 
57
57
  unless session = cached_session
58
- Logger.message "Creating a new session!"
58
+ Logger.info "Creating a new session!"
59
59
  session = create_write_and_return_new_session!
60
60
  end
61
61
 
@@ -73,7 +73,7 @@ module Backup
73
73
  if cache_exists?
74
74
  begin
75
75
  session = DropboxSession.deserialize(File.read(cached_file))
76
- Logger.message "Session data loaded from cache!"
76
+ Logger.info "Session data loaded from cache!"
77
77
 
78
78
  rescue => err
79
79
  Logger.warn Errors::Storage::Dropbox::CacheError.wrap(err, <<-EOS)
@@ -91,7 +91,7 @@ module Backup
91
91
  remote_path = remote_path_for(@package)
92
92
 
93
93
  files_to_transfer_for(@package) do |local_file, remote_file|
94
- Logger.message "#{storage_name} started transferring '#{ local_file }'."
94
+ Logger.info "#{storage_name} started transferring '#{ local_file }'."
95
95
  File.open(File.join(local_path, local_file), 'r') do |file|
96
96
  connection.put_file(File.join(remote_path, remote_file), file)
97
97
  end
@@ -110,7 +110,7 @@ module Backup
110
110
  messages << "#{storage_name} started removing " +
111
111
  "'#{ local_file }' from Dropbox."
112
112
  end
113
- Logger.message messages.join("\n")
113
+ Logger.info messages.join("\n")
114
114
 
115
115
  connection.file_delete(remote_path)
116
116
  end
@@ -67,7 +67,7 @@ module Backup
67
67
  create_remote_path(remote_path, ftp)
68
68
 
69
69
  files_to_transfer_for(@package) do |local_file, remote_file|
70
- Logger.message "#{storage_name} started transferring " +
70
+ Logger.info "#{storage_name} started transferring " +
71
71
  "'#{ local_file }' to '#{ ip }'."
72
72
  ftp.put(
73
73
  File.join(local_path, local_file),
@@ -86,7 +86,7 @@ module Backup
86
86
 
87
87
  connection do |ftp|
88
88
  transferred_files_for(package) do |local_file, remote_file|
89
- Logger.message "#{storage_name} started removing " +
89
+ Logger.info "#{storage_name} started removing " +
90
90
  "'#{ local_file }' from '#{ ip }'."
91
91
 
92
92
  ftp.delete(File.join(remote_path, remote_file))
@@ -32,7 +32,7 @@ module Backup
32
32
  FileUtils.mkdir_p(remote_path)
33
33
 
34
34
  files_to_transfer_for(@package) do |local_file, remote_file|
35
- Logger.message "#{storage_name} started transferring '#{ local_file }'."
35
+ Logger.info "#{storage_name} started transferring '#{ local_file }'."
36
36
 
37
37
  src_path = File.join(local_path, local_file)
38
38
  dst_path = File.join(remote_path, remote_file)
@@ -51,7 +51,7 @@ module Backup
51
51
  transferred_files_for(package) do |local_file, remote_file|
52
52
  messages << "#{storage_name} started removing '#{ local_file }'."
53
53
  end
54
- Logger.message messages.join("\n")
54
+ Logger.info messages.join("\n")
55
55
 
56
56
  FileUtils.rm_r(remote_path)
57
57
  end