summaryrefslogtreecommitdiff
path: root/lib/byteback
diff options
context:
space:
mode:
authorChris Elsworth <chris.elsworth@bytemark.co.uk>2017-01-31 11:17:20 +0000
committerChris Elsworth <chris.elsworth@bytemark.co.uk>2017-01-31 11:17:20 +0000
commit1943b5a11ed6615816bd476d16f2f319edfc772d (patch)
treeb29957f0d21fa0adcafab48bcd9f90bc05da022a /lib/byteback
parent1586557ca5639d160300697cd65067536b66e5d1 (diff)
parent566c4c39e58e001015d263df124ea88d06ba5940 (diff)
Merge branch '7-error-when-non-timestamp-directory-in-backup-destination' into 'master'
Resolve "Error when non-timestamp directory in backup destination" Closes #7 See merge request !6
Diffstat (limited to 'lib/byteback')
-rw-r--r--lib/byteback/restore.rb3
-rw-r--r--lib/byteback/restore_file.rb9
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/byteback/restore.rb b/lib/byteback/restore.rb
index d313209..7055be3 100644
--- a/lib/byteback/restore.rb
+++ b/lib/byteback/restore.rb
@@ -65,11 +65,10 @@ module Byteback
@results = paths.collect do |path|
Dir.glob(File.expand_path(File.join(@byteback_root, @snapshot, path))).collect do |f|
- restore_file = Byteback::RestoreFile.new(f, @byteback_root, @now)
+ Byteback::RestoreFile.new(f, @byteback_root, @now)
end
end.flatten
-
#
# If we want an unpruned list, return it now.
#
diff --git a/lib/byteback/restore_file.rb b/lib/byteback/restore_file.rb
index 5811b0f..daceb83 100644
--- a/lib/byteback/restore_file.rb
+++ b/lib/byteback/restore_file.rb
@@ -45,10 +45,13 @@ module Byteback
#
@snapshot = full_path.sub(%r(^#{Regexp.escape @byteback_root}),'').split("/")[1]
- if @snapshot == "current"
- @snapshot_time = @now
- else
+ #
+ # If we can parse the time, use it, otherwise assume "now".
+ #
+ begin
@snapshot_time = Time.parse(@snapshot)
+ rescue ArgumentError
+ @snapshot_time = @now
end
#