Class: Epas::AutoSigner
- Inherits:
-
Object
- Object
- Epas::AutoSigner
- Defined in:
- lib/epas.rb
Instance Method Summary collapse
-
#initialize(file = "~/.awssecret", regions = []) ⇒ AutoSigner
constructor
Creates a new auto_signer object tied to the specific ec2 account and regions provided.
-
#sign_ec2_instance_requests! ⇒ Object
Signs all pending requests in puppet initiated by ec2 machines.
Constructor Details
#initialize(file = "~/.awssecret", regions = []) ⇒ AutoSigner
Creates a new auto_signer object tied to the specific ec2 account and regions provided.
Attributes
-
file
- Path to a file containing only the EC2 id and secret access_keys in the two first lines and in this order. Defaults to “~/.awssecret”. -
regions
- Array containing all EC2 regions to check, defaults to all available.
Examples
Epas::Autosigner.new
Epas::AutoSigner.new myfile, [ 'eu-west-1', 'eu-east-1']
24 25 26 27 28 29 |
# File 'lib/epas.rb', line 24 def initialize(file = "~/.awssecret", regions = []) raise UnavailablePuppet unless command?('puppet') && command?('puppetca') @aws_id, @aws_key = read_aws_credentials(file) @regions = regions.blank? ? get_all_ec2_regions : regions @awaiting_sign_instances = get_awaiting_sign_instances end |
Instance Method Details
#sign_ec2_instance_requests! ⇒ Object
Signs all pending requests in puppet initiated by ec2 machines.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/epas.rb', line 32 def sign_ec2_instance_requests! # TODO: Add logging to syslog unless @awaiting_sign_instances.blank? get_all_ec2_instances_ids.each do |instance_id| @awaiting_sign_instances.each do |hostname| sign_instance(hostname) if hostname.match /#{instance_id}/ end end end end |