Class: Wordmove::Actions::Ssh::DownloadRemoteDb
- Inherits:
-
Object
- Object
- Wordmove::Actions::Ssh::DownloadRemoteDb
- Extended by:
- LightService::Action
- Defined in:
- lib/wordmove/actions/ssh/download_remote_db.rb
Overview
Downloads the remote DB over SSH protocol
Class Method Summary collapse
-
.execute ⇒ LightService::Context
Action’s context.
Class Method Details
.execute ⇒ LightService::Context
Returns Action’s context.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/wordmove/actions/ssh/download_remote_db.rb', line 26 executed do |context| # rubocop:disable Metrics/BlockLength context.logger.task 'Download remote DB' next context if simulate?(cli_options: context.) result = Wordmove::Actions::Ssh::RunRemoteCommand.execute( cli_options: context., photocopier: context.photocopier, logger: context.logger, command: mysql_dump_command( env_db_options: context.[:database], save_to_path: context.db_paths.remote.path ) ) context.fail_and_return!(result.) if result.failure? result = Wordmove::Actions::Ssh::RunRemoteCommand.execute( cli_options: context., photocopier: context.photocopier, logger: context.logger, command: compress_command(file_path: context.db_paths.remote.path) ) context.fail_and_return!(result.) if result.failure? result = Wordmove::Actions::GetFile.execute( photocopier: context.photocopier, logger: context.logger, cli_options: context., command_args: [ context.db_paths.remote.gzipped_path, context.db_paths.local.gzipped_path ] ) context.fail_and_return!(result.) if result.failure? result = Wordmove::Actions::DeleteRemoteFile.execute( photocopier: context.photocopier, logger: context.logger, cli_options: context., remote_file: context.db_paths.remote.gzipped_path ) if result.failure? context.logger.warning 'Failed to delete remote file ' \ "#{context.db_paths.remote.gzipped_path} because: " \ "#{result.}" \ '. Manual intervention required' end context.logger.success( "Remote DB dump downloaded in #{context.db_paths.local.gzipped_path}" ) end |