Class: Mccloud::Provider::Core::Vm
- Inherits:
-
Object
- Object
- Mccloud::Provider::Core::Vm
- Includes:
- VmCommand
- Defined in:
- lib/mccloud/provider/core/vm.rb
Direct Known Subclasses
Aws::Vm, Host::Vm, Libvirt::Vm, Script::Vm, Vagrant::Vm, Vmfusion::Vm
Instance Attribute Summary collapse
-
#agent_forwarding ⇒ Object
Returns the value of attribute agent_forwarding.
-
#auto_selection ⇒ Object
Returns the value of attribute auto_selection.
-
#bootstrap ⇒ Object
Returns the value of attribute bootstrap.
-
#bootstrap_password ⇒ Object
Returns the value of attribute bootstrap_password.
-
#bootstrap_user ⇒ Object
Returns the value of attribute bootstrap_user.
-
#create_options ⇒ Object
Returns the value of attribute create_options.
-
#declared ⇒ Object
Returns the value of attribute declared.
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#forwardings ⇒ Object
Returns the value of attribute forwardings.
-
#name ⇒ Object
Returns the value of attribute name.
-
#port ⇒ Object
Returns the value of attribute port.
-
#private_key_path ⇒ Object
Returns the value of attribute private_key_path.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#provisioners ⇒ Object
Returns the value of attribute provisioners.
-
#public_key_path ⇒ Object
Returns the value of attribute public_key_path.
-
#shared_files ⇒ Object
Returns the value of attribute shared_files.
-
#shared_folders ⇒ Object
Returns the value of attribute shared_folders.
-
#stacked ⇒ Object
Returns the value of attribute stacked.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #auto_selected? ⇒ Boolean
- #declared? ⇒ Boolean
- #forward_port(name, remote, local) ⇒ Object
-
#initialize(env) ⇒ Vm
constructor
A new instance of Vm.
- #method_missing(m, *args, &block) ⇒ Object
-
#provision(type) ⇒ Object
This function is swapped with the component provision function while reading the configuration.
- #provisioner ⇒ Object
- #stacked? ⇒ Boolean
Methods included from 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.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/mccloud/provider/core/vm.rb', line 58 def initialize(env) @env=env @forwardings=Array.new @shared_folders = Array.new @shared_files = Array.new @stacked=false @auto_selection=true @declared=true @provisioners=Array.new @port=22 @agent_forwarding=false @create_options={} @definition=nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
116 117 118 |
# File 'lib/mccloud/provider/core/vm.rb', line 116 def method_missing(m, *args, &block) env.logger.info "There's no keyword #{m} defined for vm #{@name}-- ignoring it" end |
Instance Attribute Details
#agent_forwarding ⇒ Object
Returns the value of attribute agent_forwarding.
43 44 45 |
# File 'lib/mccloud/provider/core/vm.rb', line 43 def agent_forwarding @agent_forwarding end |
#auto_selection ⇒ Object
Returns the value of attribute auto_selection.
45 46 47 |
# File 'lib/mccloud/provider/core/vm.rb', line 45 def auto_selection @auto_selection end |
#bootstrap ⇒ Object
Returns the value of attribute bootstrap.
47 48 49 |
# File 'lib/mccloud/provider/core/vm.rb', line 47 def bootstrap @bootstrap end |
#bootstrap_password ⇒ Object
Returns the value of attribute bootstrap_password.
49 50 51 |
# File 'lib/mccloud/provider/core/vm.rb', line 49 def bootstrap_password @bootstrap_password end |
#bootstrap_user ⇒ Object
Returns the value of attribute bootstrap_user.
48 49 50 |
# File 'lib/mccloud/provider/core/vm.rb', line 48 def bootstrap_user @bootstrap_user end |
#create_options ⇒ Object
Returns the value of attribute create_options.
37 38 39 |
# File 'lib/mccloud/provider/core/vm.rb', line 37 def @create_options end |
#declared ⇒ Object
Returns the value of attribute declared.
56 57 58 |
# File 'lib/mccloud/provider/core/vm.rb', line 56 def declared @declared end |
#definition ⇒ Object
Returns the value of attribute definition.
35 36 37 |
# File 'lib/mccloud/provider/core/vm.rb', line 35 def definition @definition end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
32 33 34 |
# File 'lib/mccloud/provider/core/vm.rb', line 32 def env @env end |
#forwardings ⇒ Object
Returns the value of attribute forwardings.
52 53 54 |
# File 'lib/mccloud/provider/core/vm.rb', line 52 def forwardings @forwardings end |
#name ⇒ Object
Returns the value of attribute name.
38 39 40 |
# File 'lib/mccloud/provider/core/vm.rb', line 38 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
40 41 42 |
# File 'lib/mccloud/provider/core/vm.rb', line 40 def port @port end |
#private_key_path ⇒ Object
Returns the value of attribute private_key_path.
41 42 43 |
# File 'lib/mccloud/provider/core/vm.rb', line 41 def private_key_path @private_key_path end |
#provider ⇒ Object
Returns the value of attribute provider.
34 35 36 |
# File 'lib/mccloud/provider/core/vm.rb', line 34 def provider @provider end |
#provisioners ⇒ Object
Returns the value of attribute provisioners.
50 51 52 |
# File 'lib/mccloud/provider/core/vm.rb', line 50 def provisioners @provisioners end |
#public_key_path ⇒ Object
Returns the value of attribute public_key_path.
42 43 44 |
# File 'lib/mccloud/provider/core/vm.rb', line 42 def public_key_path @public_key_path end |
#shared_files ⇒ Object
Returns the value of attribute shared_files.
54 55 56 |
# File 'lib/mccloud/provider/core/vm.rb', line 54 def shared_files @shared_files end |
#shared_folders ⇒ Object
Returns the value of attribute shared_folders.
53 54 55 |
# File 'lib/mccloud/provider/core/vm.rb', line 53 def shared_folders @shared_folders end |
#stacked ⇒ Object
Returns the value of attribute stacked.
55 56 57 |
# File 'lib/mccloud/provider/core/vm.rb', line 55 def stacked @stacked end |
#user ⇒ Object
Returns the value of attribute user.
39 40 41 |
# File 'lib/mccloud/provider/core/vm.rb', line 39 def user @user end |
Instance Method Details
#auto_selected? ⇒ Boolean
81 82 83 |
# File 'lib/mccloud/provider/core/vm.rb', line 81 def auto_selected? return auto_selection end |
#declared? ⇒ Boolean
73 74 75 |
# File 'lib/mccloud/provider/core/vm.rb', line 73 def declared? return declared end |
#forward_port(name, remote, local) ⇒ Object
111 112 113 114 |
# File 'lib/mccloud/provider/core/vm.rb', line 111 def forward_port(name,remote,local) forwarding=Forwarding.new(name,remote,local) forwardings << forwarding end |
#provision(type) ⇒ Object
This function is swapped with the component provision function while reading the configuration
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/mccloud/provider/core/vm.rb', line 95 def provision(type) if block_given? case type when :chef_solo @provisioners<< Mccloud::Provisioner::ChefSolo.new(env) when :puppet @provisioners<<Mccloud::Provisioner::Puppet.new(env) when :shell @provisioners<<Mccloud::Provisioner::Shell.new(env) else end yield @provisioners.last end end |
#provisioner ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/mccloud/provider/core/vm.rb', line 85 def provisioner if provisioners.nil? return nil else provisioners.first end end |
#stacked? ⇒ Boolean
77 78 79 |
# File 'lib/mccloud/provider/core/vm.rb', line 77 def stacked? return stacked end |