Sha256: ba1d4f68062331f67278983b5954ebd6905c00e9a20937ada2bb8eabfda7dc55
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module HerokuPgBackupsArchive module ToolbeltHelper RETRIES = 5 class << self def capture_backup run("pg:backups capture -a #{HerokuPgBackupsArchive.config.app_name}") end def fetch_backup_public_url(backup_id) run("pg:backups public-url #{backup_id} -q -a #{HerokuPgBackupsArchive.config.app_name}") end def fetch_backup_info(backup_id) run("pg:backups info #{backup_id} -a #{HerokuPgBackupsArchive.config.app_name}") end private def run(arguments) command = "#{HerokuPgBackupsArchive.config.heroku_toolbelt_path} #{arguments}" puts "Running: #{command}" retries_remaining = RETRIES begin output = `#{command} 2>&1` raise OperationFailedError.new(output) unless $?.success? puts "Output:\n#{output}" return output rescue OperationFailedError => ex retries_remaining -= 1 if retries_remaining > 0 puts "Failed, retrying..." retry else puts "Still failing after #{RETRIES} retries, giving up." raise ex end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heroku_pg_backups_archive-0.2.1 | lib/heroku_pg_backups_archive/toolbelt_helper.rb |