Class: AwsRotate::Backup
- Inherits:
-
Base
- Object
- Base
- AwsRotate::Backup
show all
- Defined in:
- lib/aws_rotate/backup.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
#iam, #sts
Instance Method Details
#credentials_exist? ⇒ Boolean
11
12
13
|
# File 'lib/aws_rotate/backup.rb', line 11
def credentials_exist?
File.exist?(@credentials_path)
end
|
#run ⇒ Object
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
|