module VagrantPlugins::Openstack::Action
Public Class Methods
Source
# File lib/vagrant-openstack-provider/action.rb, line 12 def self.action_destroy new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| if env[:machine_state_id] == :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use(ProvisionerCleanup, :before) b2.use SnapshotCleanup if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.8.0') b2.use DeleteServer b2.use DeleteStack end end end end
This action is called to destroy the remote machine.
Source
# File lib/vagrant-openstack-provider/action.rb, line 156 def self.action_halt new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| if env[:machine_state_id] == :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use StopServer end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 30 def self.action_provision new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| if env[:machine_state_id] == :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') else if env[:machine].provider_config.meta_args_support b2.use ProvisionWrapper else b2.use Provision end if env[:machine].provider_config.use_legacy_synced_folders env[:machine].ui.warn I18n.t('vagrant_openstack.config.sync_folders_deprecated') b2.use SyncFolders else # Standard Vagrant implementation. b2.use SyncedFolders end end end end end
This action is called when ‘vagrant provision` is called.
Source
# File lib/vagrant-openstack-provider/action.rb, line 58 def self.action_read_ssh_info new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use ReadSSHInfo end end
This action is called to read the SSH info of the machine. The resulting state is expected to be put into the ‘:machine_ssh_info` key.
Source
# File lib/vagrant-openstack-provider/action.rb, line 69 def self.action_read_state new_builder.tap do |b| b.use HandleBox b.use ConfigValidate b.use ConnectOpenstack b.use ReadState end end
This action is called to read the state of the machine. The resulting state is expected to be put into the ‘:machine_state_id` key.
Source
# File lib/vagrant-openstack-provider/action.rb, line 212 def self.action_reload new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| case env[:machine_state_id] when :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') when :suspended b2.use Resume b2.use WaitForServerToBeActive b2.use StopServer b2.use WaitForServerToStop b2.use StartServer when :shutoff b2.use StartServer else b2.use StopServer b2.use WaitForServerToStop b2.use StartServer end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 195 def self.action_resume new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| case env[:machine_state_id] when :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') when :suspended b2.use Resume else b2.use Message, I18n.t('vagrant_openstack.not_suspended') end end end end
This is the action that is primarily responsible for resuming suspended machines. Vm cannot be resumed when the machine_state_id is not suspended.
Source
# File lib/vagrant-openstack-provider/action.rb, line 240 def self.action_snapshot_delete new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, IsState, :not_created do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use SnapshotDelete end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 254 def self.action_snapshot_list new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, IsState, :not_created do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use SnapshotList end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 268 def self.action_snapshot_restore new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, IsState, :not_created do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_openstack.not_created') next end b2.use SnapshotRestore b2.use WaitForServerToBeActive b2.use WaitForCommunicator b2.use Call, IsEnvSet, :snapshot_delete do |env2, b3| # Used by vagrant push/pop b3.use action_snapshot_delete if env2[:result] end b2.use action_provision end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 292 def self.action_snapshot_save new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, IsState, :not_created do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use SnapshotSave end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 78 def self.action_ssh new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| if env[:machine_state_id] == :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use SSHExec end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 92 def self.action_ssh_run new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| if env[:machine_state_id] == :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') else b2.use SSHRun end end end end
Source
# File lib/vagrant-openstack-provider/action.rb, line 173 def self.action_suspend new_builder.tap do |b| b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| case env[:machine_state_id] when :not_created b2.use Message, I18n.t('vagrant_openstack.not_created') when :suspended b2.use Message, I18n.t('vagrant_openstack.already_suspended') when :active b2.use Suspend else b2.use Message, I18n.t('vagrant_openstack.ongoing_task') end end end end
This is the action that is primarily responsible for suspending the virtual machine. Vm cannot be suspended when the machine_state_id is not “active” (typically a task is ongoing)
Source
# File lib/vagrant-openstack-provider/action.rb, line 106 def self.action_up new_builder.tap do |b| b.use HandleBox b.use ConfigValidate b.use ConnectOpenstack b.use Call, ReadState do |env, b2| case env[:machine_state_id] when :not_created ssh_disabled = env[:machine].provider_config.ssh_disabled unless ssh_disabled if env[:machine].provider_config.meta_args_support b2.use ProvisionWrapper else b2.use Provision end end if env[:machine].provider_config.use_legacy_synced_folders env[:machine].ui.warn I18n.t('vagrant_openstack.config.sync_folders_deprecated') b2.use SyncFolders else # Standard Vagrant implementation. b2.use SyncedFolders end b2.use CreateStack b2.use CreateServer b2.use Message, I18n.t('vagrant_openstack.ssh_disabled_provisioning') if ssh_disabled unless ssh_disabled # Handle legacy ssh_timeout option timeout = env[:machine].provider_config.ssh_timeout unless timeout.nil? env[:machine].ui.warn I18n.t('vagrant_openstack.config.ssh_timeout_deprecated') env[:machine].config.vm.boot_timeout = timeout end b2.use WaitForCommunicator end when :shutoff b2.use StartServer when :suspended b2.use Resume else b2.use Message, I18n.t('vagrant_openstack.already_created') end end end end
Source
# File lib/vagrant-openstack-provider/action/read_ssh_info.rb, line 69 def self.get_ssh_info(env) SSHInfoHolder.instance.ssh_info[env[:machine].id.to_sym] end
Source
# File lib/vagrant-openstack-provider/action.rb, line 339 def self.new_builder Vagrant::Action::Builder.new end
rubocop:enable IndentationWidth