module VagrantPlugins::SecuredCloud::Action
Public Class Methods
destroy()
click to toggle source
This action is called to delete the VM
# File lib/secured-cloud-vagrant/action.rb, line 62 def self.destroy @logger.debug("Calling 'DESTROY' action ... ") return Vagrant::Action::Builder.new.tap do |builder| # Validate the configurations builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :not_created env[:ui].info I18n.t('secured_cloud_vagrant.info.not_created') else b.use Call, DestroyConfirm do |env2, b2| if(env2[:result]) # Power OFF the VM if it's ON if(env[:machine_state] == :active) b2.use PowerOff b2.use WaitForState end b2.use Call, HasPublicIps do |env3, b3| if(env3[:has_public_ips]) b3.use ReleaseIpsConfirm end b3.use Delete end end end end end end end
halt()
click to toggle source
This action is called to halt the VM
# File lib/secured-cloud-vagrant/action.rb, line 103 def self.halt @logger.debug("Calling 'HALT' action ... ") return Vagrant::Action::Builder.new.tap do |builder| # Validate the configurations builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :active b.use PowerOff when :stopped env[:ui].info I18n.t('secured_cloud_vagrant.info.already_off') when :not_created env[:ui].info I18n.t('secured_cloud_vagrant.info.not_created') end end end end
provision()
click to toggle source
This action is called to provision a remote VM
# File lib/secured-cloud-vagrant/action.rb, line 48 def self.provision @logger.debug("Calling 'PROVISION' action ... ") return Vagrant::Action::Builder.new.tap do |builder| builder.use WarnProvision end end
read_machine_state()
click to toggle source
This action is called to get the state of the VM
# File lib/secured-cloud-vagrant/action.rb, line 230 def self.read_machine_state @logger.debug("Calling 'READ_MACHINE_STATE' action ... ") return Vagrant::Action::Builder.new.tap do |builder| builder.use ConfigValidate builder.use CheckState end end
read_ssh_info()
click to toggle source
This action is called to get the SSH information to connect to the VM
# File lib/secured-cloud-vagrant/action.rb, line 203 def self.read_ssh_info @logger.debug("Calling 'READ_SSH_INFO' action ... ") return Vagrant::Action::Builder.new.tap do |builder| # Validate the configurations builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :not_created env[:ui].info I18n.t('secured_cloud_vagrant.states.not_created.long', :vm_name => env[:machine].provider_config.vm.name) when :active, :stopped b.use ReadSshInfo end end end end
reload()
click to toggle source
This action is called to halt the VM
# File lib/secured-cloud-vagrant/action.rb, line 128 def self.reload @logger.debug("Calling 'RELOAD' action ... ") return Vagrant::Action::Builder.new.tap do |builder| # Validate the configurations builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :active b.use Reboot when :stopped b.use PowerOn when :not_created env[:ui].info I18n.t('secured_cloud_vagrant.states.not_created.long', :vm_name => env[:machine].provider_config.vm.name) end end end end
ssh()
click to toggle source
This action is called to connect to the VM through SSH
# File lib/secured-cloud-vagrant/action.rb, line 153 def self.ssh @logger.debug("Calling 'SSH' action ... ") return Vagrant::Action::Builder.new.tap do |builder| # Validate the configurations builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :active b.use SSHExec when :not_created, :stopped vm_name = (env[:vm_name].nil? || env[:vm_name].empty?) ? env[:machine].provider_config.vm.name : env[:vm_name] env[:ui].info I18n.t("secured_cloud_vagrant.states.#{env[:machine_state]}.long", :vm_name => vm_name) end end end end
ssh_run()
click to toggle source
This action is called to connect to run a single SSH command
# File lib/secured-cloud-vagrant/action.rb, line 177 def self.ssh_run @logger.debug("Calling 'SSH_RUN' action ... ") return Vagrant::Action::Builder.new.tap do |builder| # Validate the configurations builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :active b.use SSHRun when :not_created, :stopped vm_name = (env[:vm_name].nil? || env[:vm_name].empty?) ? env[:machine].provider_config.vm.name : env[:vm_name] env[:ui].info I18n.t("secured_cloud_vagrant.states.#{env[:machine_state]}.long", :vm_name => vm_name) end end end end
up()
click to toggle source
This action is called to bring the box up from nothing
# File lib/secured-cloud-vagrant/action.rb, line 17 def self.up @logger.debug("Calling 'UP' action ... ") return Vagrant::Action::Builder.new.tap do |builder| builder.use ConfigValidate builder.use Call, CheckState do |env, b| case env[:machine_state] when :active env[:ui].info I18n.t('secured_cloud_vagrant.info.already_active') when :stopped b.use PowerOn b.use provision when :not_created b.use Create b.use AssignPublicIps b.use provision end end builder.use WarnNetworks end end