Sha256: 38bb9fc773de05bb7cde831dfe4f24906d7a673719d3540d5e295eefdab95a10
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
module Wordmove module Actions module Ssh # Bakups an alrady downloaded remote dump class BackupRemoteDb extend ::LightService::Action include Wordmove::Actions::Helpers expects :cli_options, :logger, :db_paths # @!method execute # @param cli_options [Hash] Command line options (with symbolized keys) # @param logger [Wordmove::Logger] # @param db_paths [BbPathsConfig] Configuration object for database # @!scope class # @return [LightService::Context] Action's context executed do |context| next context if context.database_task == false context.logger.task 'Backup remote DB' if simulate?(cli_options: context.cli_options) context.logger.info 'A backup of the remote DB would have been saved into ' \ "#{context.db_paths.backup.remote.gzipped_path}, " \ 'but you\'re simulating' next context end # Most of the expectations are needed to be proxied to `DownloadRemoteDb` # Wordmove::Actions::Ssh::DownloadRemoteDb.execute(context) # DownloadRemoteDB will save the file in `db_paths.local.gzipped_path` begin FileUtils.mv( context.db_paths.local.gzipped_path, context.db_paths.backup.remote.gzipped_path ) context.logger.success( "Backup saved at #{context.db_paths.backup.remote.gzipped_path}" ) rescue Errno::ENOENT => e context.fail_and_return!("Remote DB backup failed with: #{e.message}. Aborting.") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wordmove-6.0.0.alpha.3 | lib/wordmove/actions/ssh/backup_remote_db.rb |
wordmove-6.0.0.alpha.2 | lib/wordmove/actions/ssh/backup_remote_db.rb |