Class: VagrantPlugins::Proxmox::Action::ConnectProxmox
- Inherits:
-
ProxmoxAction
- Object
- ProxmoxAction
- VagrantPlugins::Proxmox::Action::ConnectProxmox
- Defined in:
- lib/vagrant-proxmox/action/connect_proxmox.rb
Overview
This action connects to the Proxmox server and stores the connection in env
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ConnectProxmox
constructor
A new instance of ConnectProxmox.
Constructor Details
#initialize(app, env) ⇒ ConnectProxmox
Returns a new instance of ConnectProxmox.
9 10 11 12 |
# File 'lib/vagrant-proxmox/action/connect_proxmox.rb', line 9 def initialize app, env @app = app @logger = Log4r::Logger.new 'vagrant_proxmox::action::connect_proxmox' end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-proxmox/action/connect_proxmox.rb', line 14 def call env begin config = env[:machine].provider_config connection = Connection.new config.endpoint, vm_id_range: config.vm_id_range, task_timeout: config.task_timeout, task_status_check_interval: config.task_status_check_interval, imgcopy_timeout: config.imgcopy_timeout connection.login username: config.user_name, password: config.password env[:proxmox_connection] = connection rescue => e raise Errors::CommunicationError, error_msg: e. end next_action env end |