Class: VagrantPlugins::OpenStack::Action::TakeSnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-openstack-plugin/action/take_snapshot.rb

Overview

This reboots a running server, if there is one.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ TakeSnapshot

Returns a new instance of TakeSnapshot.



8
9
10
11
# File 'lib/vagrant-openstack-plugin/action/take_snapshot.rb', line 8

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_openstack::action::take_snapshot")
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-openstack-plugin/action/take_snapshot.rb', line 13

def call(env)
  if env[:machine].id
    env[:ui].info(I18n.t("vagrant_openstack.snapshoting_server"))
    infos = env[:openstack_compute].get_server_details(env[:machine].id)
    env[:openstack_compute].create_image(env[:machine].id,env[:openstack_snapshot_name] || 'snapshot')

  end

  @app.call(env)
end