Module: ForemanMaintain::Cli::BackupCommon
- Included in:
- OfflineBackupCommand, OnlineBackupCommand
- Defined in:
- lib/foreman_maintain/cli/backup_command.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #backup_dir ⇒ Object
- #backup_subdir ⇒ Object
- #perform_backup(strategy, options = {}) ⇒ Object
- #timestamp ⇒ Object
Class Method Details
.included(klass) ⇒ Object
4 5 6 |
# File 'lib/foreman_maintain/cli/backup_command.rb', line 4 def self.included(klass) klass.extend ClassMethods end |
Instance Method Details
#backup_dir ⇒ Object
8 9 10 |
# File 'lib/foreman_maintain/cli/backup_command.rb', line 8 def backup_dir @backup_dir ||= preserve_directory? ? backup_root_dir : backup_subdir end |
#backup_subdir ⇒ Object
16 17 18 19 |
# File 'lib/foreman_maintain/cli/backup_command.rb', line 16 def backup_subdir name = feature(:instance).product_name.downcase.tr(' ', '-') File.join(backup_root_dir, "#{name}-backup-" + ) end |
#perform_backup(strategy, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/foreman_maintain/cli/backup_command.rb', line 21 def perform_backup(strategy, = {}) backup_scenario = backup_scenario(, strategy) rescue_scenario = rescue_scenario(, strategy) puts "Starting backup: #{Time.now}" run_scenario(backup_scenario, rescue_scenario) puts "Done with backup: #{Time.now}" exit runner.exit_code end |
#timestamp ⇒ Object
12 13 14 |
# File 'lib/foreman_maintain/cli/backup_command.rb', line 12 def DateTime.now.strftime('%Y-%m-%d-%H-%M-%S') end |