Class: Vagrant::Commit::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-commit/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



9
10
11
# File 'lib/vagrant-commit/command.rb', line 9

def self.synopsis
  "(plugin) qemu-img commit the volumes"
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-commit/command.rb', line 13

def execute
  opts = OptionParser.new do |o|
    o.banner = "Usage: vagrant commit [name|id]"
  end

  # Parse the options
  argv = parse_options(opts)

  with_target_vms(argv) do |machine|
    machine_name = machine.name.to_s
    if machine.state.id != :shutoff
      @env.ui.info("Halting #{machine_name}")
    end
    machine.action(:halt)
    @env.action_runner.run(Vagrant::Commit::Action.action_commit_volumes, {
      :machine => machine,
    })

  end
end