lib/shelly/cli/backup.rb in shelly-0.0.40 vs lib/shelly/cli/backup.rb in shelly-0.0.41.pre
- old
+ new
@@ -28,14 +28,14 @@
print_table(to_display, :ident => 2)
else
say "No database backups available"
end
rescue Client::APIError => e
- if e.unauthorized?
+ if e.not_found?
say_error "You have no access to '#{@app.code_name}' cloud defined in Cloudfile"
else
- say_error e.message
+ raise e
end
end
method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify which cloud list backups for"
desc "get [FILENAME]", "Downloads specified or last backup to current directory"
@@ -47,15 +47,17 @@
backup.download(bar.progress_callback)
say_new_line
say "Backup file saved to #{backup.filename}", :green
rescue Client::APIError => e
- if e.not_found?
+ case e.resource_not_found
+ when :cloud
+ say_error "You have no access to '#{@app.code_name}' cloud defined in Cloudfile"
+ when :backup
say_error "Backup not found", :with_exit => false
say "You can list available backups with 'shelly backup list' command"
- else
- raise e
+ else; raise e
end
end
desc "create [KIND]", "Creates current snapshot of given database. Default: all databases."
method_option :cloud, :type => :string, :aliases => "-c",
@@ -64,10 +66,10 @@
multiple_clouds(options[:cloud], "backup create", "Select cloud to create snapshot of database")
@app.request_backup(kind)
say "Backup requested. It can take up to several minutes for" +
"the backup process to finish and the backup to show up in backups list.", :green
rescue Client::APIError => e
- if e.unauthorized?
+ if e.not_found?
say_error "You have no access to '#{@app.code_name}' cloud defined in Cloudfile"
else
say_error e.message
end
end