Class: Maestro::Node::Aws::Ec2

Inherits:
Configurable show all
Defined in:
lib/maestro/cloud/aws.rb

Overview

Amazon EC2 Node

Constant Summary

Constants inherited from Configurable

Configurable::DEFAULT_SSH_USER

Instance Attribute Summary collapse

Attributes inherited from Configurable

#json, #json_filename

Attributes inherited from Base

#cloud, #hostname, #ip_address, #log_file, #logger, #name

Attributes included from Validator

#valid, #validation_errors

Instance Method Summary collapse

Methods inherited from Base

#disable_stdout, #enable_stdout, #method_missing

Methods included from Validator

#invalidate, #valid?, #validate

Constructor Details

#initialize(name, cloud, &block) ⇒ Ec2

Creates a new Ec2 Node



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'lib/maestro/cloud/aws.rb', line 1005

def initialize(name, cloud, &block)
  super(name, cloud, &block)
  @security_groups = Array.new
  @role_security_groups = Array.new
  @node_security_group = "#{node_prefix}#{@name}"
  @security_groups << @node_security_group
  if !@roles.nil? && !@roles.empty?
    @roles.each do |role_name|
      role_security_group = "#{role_prefix}#{role_name}"
      @role_security_groups << role_security_group
      @security_groups << role_security_group
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Maestro::Node::Base

Instance Attribute Details

#node_security_groupObject

Returns the value of attribute node_security_group.



1001
1002
1003
# File 'lib/maestro/cloud/aws.rb', line 1001

def node_security_group
  @node_security_group
end

#role_security_groupsObject

Returns the value of attribute role_security_groups.



1002
1003
1004
# File 'lib/maestro/cloud/aws.rb', line 1002

def role_security_groups
  @role_security_groups
end

#security_groupsObject

Returns the value of attribute security_groups.



1000
1001
1002
# File 'lib/maestro/cloud/aws.rb', line 1000

def security_groups
  @security_groups
end

Instance Method Details

#set_default_security_group(security_group) ⇒ Object

sets the default security group for the cloud on this Ec2 Node



1021
1022
1023
1024
# File 'lib/maestro/cloud/aws.rb', line 1021

def set_default_security_group(security_group)
  @security_groups << security_group if !@security_groups.include?(security_group)
  @role_security_groups << security_group if !@role_security_groups.include?(security_group)
end