Class: Mccloud::Provider::Aws::Vm
- Includes:
- VmCommand
- Defined in:
- lib/mccloud/provider/aws/vm.rb,
lib/mccloud/provider/aws/stack/old_vm.rb
Instance Attribute Summary collapse
-
#ami ⇒ Object
Inherits user, name,port private_key_path, public_key_path bootstrap, auto_selection forwardings provider.
-
#flavor ⇒ Object
Returns the value of attribute flavor.
-
#key_name ⇒ Object
Returns the value of attribute key_name.
-
#security_groups ⇒ Object
Returns the value of attribute security_groups.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#user_data ⇒ Object
Returns the value of attribute user_data.
-
#zone ⇒ Object
Returns the value of attribute zone.
Attributes inherited from Core::Vm
#agent_forwarding, #auto_selection, #bootstrap, #bootstrap_password, #bootstrap_user, #create_options, #declared, #definition, #env, #forwardings, #name, #port, #private_key_path, #provider, #provisioners, #public_key_path, #shared_files, #shared_folders, #stacked, #user
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(env) ⇒ Vm
constructor
A new instance of Vm.
- #ip_address ⇒ Object
- #private_ip_address ⇒ Object
- #public_ip_address ⇒ Object
- #raw ⇒ Object
- #running? ⇒ Boolean
Methods included from VmCommand
#_bootstrap, #_provision, #check_key, #check_security_groups, #destroy, #forward, #halt, #key_is_managed_by_mccloud?, #package, #reload, #rsync, #sanitize, #scp, #security_group_exists?, #security_group_has_ssh_open?, #security_group_is_managed_by_mccloud?, #ssh, #transfer, #up
Methods inherited from Core::Vm
#auto_selected?, #declared?, #forward_port, #method_missing, #provision, #provisioner, #stacked?
Methods included from Core::VmCommand
#adjust_rsync_path, #bg_exec, #execute, #fg_exec, #rsync, #rsync_permissions, #share, #share_file, #share_folder, #share_sync, #ssh, #ssh_bootstrap, #ssh_commandline_options, #ssh_forward, #ssh_tunnel_start, #ssh_tunnel_stop, #sudo, #sudo_string, #windows_client?
Constructor Details
#initialize(env) ⇒ Vm
Returns a new instance of Vm.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/mccloud/provider/aws/vm.rb', line 37 def initialize(env) # Todo calculate the best default based # On provider region super(env) @key_name = [ "mccloud"] # Todo calculate the best default based # On provider region @zone="eu-west-1a" @security_groups=[ "mccloud"] @flavor="t1.micro" # Todo calculate the ubuntu one based # on provider region and flavor @ami="ami-e59ca991" # Empty tags, but on up the name get's added @tags = {} @user = "root" @user_data = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Mccloud::Provider::Core::Vm
Instance Attribute Details
#ami ⇒ Object
Inherits user, name,port
private_key_path, public_key_path
bootstrap, auto_selection
forwardings
provider
27 28 29 |
# File 'lib/mccloud/provider/aws/vm.rb', line 27 def ami @ami end |
#flavor ⇒ Object
Returns the value of attribute flavor.
33 34 35 |
# File 'lib/mccloud/provider/aws/vm.rb', line 33 def flavor @flavor end |
#key_name ⇒ Object
Returns the value of attribute key_name.
29 30 31 |
# File 'lib/mccloud/provider/aws/vm.rb', line 29 def key_name @key_name end |
#security_groups ⇒ Object
Returns the value of attribute security_groups.
31 32 33 |
# File 'lib/mccloud/provider/aws/vm.rb', line 31 def security_groups @security_groups end |
#tags ⇒ Object
Returns the value of attribute tags.
28 29 30 |
# File 'lib/mccloud/provider/aws/vm.rb', line 28 def @tags end |
#user_data ⇒ Object
Returns the value of attribute user_data.
32 33 34 |
# File 'lib/mccloud/provider/aws/vm.rb', line 32 def user_data @user_data end |
#zone ⇒ Object
Returns the value of attribute zone.
30 31 32 |
# File 'lib/mccloud/provider/aws/vm.rb', line 30 def zone @zone end |
Instance Method Details
#id ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/mccloud/provider/aws/vm.rb', line 67 def id unless raw.nil? return raw.id else return nil end end |
#ip_address ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/mccloud/provider/aws/vm.rb', line 74 def ip_address # For VPC ip = self.public_ip_address return ip unless ip.nil? ip = self.private_ip_address return ip unless ip.nil? return nil end |
#private_ip_address ⇒ Object
92 93 94 95 96 97 98 99 |
# File 'lib/mccloud/provider/aws/vm.rb', line 92 def private_ip_address unless raw.nil? ip=raw.private_ip_address else ip=nil end return ip end |
#public_ip_address ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/mccloud/provider/aws/vm.rb', line 83 def public_ip_address unless raw.nil? ip=raw.public_ip_address else ip=nil end return ip end |
#raw ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/mccloud/provider/aws/vm.rb', line 102 def raw if @raw.nil? rawname="#{@provider.filter}#{@name}" @provider.raw.servers.each do |vm| name=nil name=vm.["Name"].strip unless vm.["Name"].nil? if name==rawname @raw=vm # Add it to make scp work the first time @raw.private_key_path=@private_key_path @raw.username = @user end end else # Refresh this every time it is referenced @raw.private_key_path=@private_key_path @raw.username = @user end return @raw end |
#running? ⇒ Boolean
59 60 61 62 63 64 65 |
# File 'lib/mccloud/provider/aws/vm.rb', line 59 def running? if raw.nil? return false else return raw.ready? end end |