Class: AwsRotate::Backup

Inherits:
Base
  • Object
show all
Defined in:
lib/aws_rotate/backup.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from AwsServices

#iam, #sts

Constructor Details

This class inherits a constructor from AwsRotate::Base

Instance Method Details

#credentials_exist?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/aws_rotate/backup.rb', line 11

def credentials_exist?
  File.exist?(@credentials_path)
end

#runObject



3
4
5
6
7
8
9
# File 'lib/aws_rotate/backup.rb', line 3

def run
  return if @options[:noop] || @options[:backup] == false
  return unless credentials_exist?
  backup_path = @credentials_path + ".bak-#{Time.now.strftime("%F-%T")}"
  FileUtils.cp(@credentials_path, backup_path)
  puts "Backed up credentials file at: #{backup_path}"
end