class AwsRotate::Base
Public Class Methods
new(options={})
click to toggle source
# File lib/aws_rotate/base.rb, line 5 def initialize(options={}) @options = options @config_path = options[:config] || "#{ENV['HOME']}/.aws/config" @credentials_path = options[:credentials] || "#{ENV['HOME']}/.aws/credentials" @profile = ENV['AWS_PROFILE'] || default_profile end
Private Instance Methods
default_profile()
click to toggle source
# File lib/aws_rotate/base.rb, line 13 def default_profile if ENV['AWS_PROFILE'].nil? lines = IO.readlines(@credentials_path) default_found = lines.detect { |l| l =~ /\[default\]/ } 'default' if default_found else abort("AWS_PROFILE must be set") end end
sh(command)
click to toggle source
# File lib/aws_rotate/base.rb, line 23 def sh(command) # no puts so we dont puts out the secret key value # puts "=> #{command}" # uncomment to debug success = system(command) raise unless success end