Sha256: 8af25e1fc6f61e584a0d2e8d34c0b2894c92b05f4365b87beb6196738d8b34cf

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require "vagrant"
require "vagrant/action/builder"
require "pathname"
require "vagrant-openstack-plugin/action"


module VagrantPlugins
  module OpenStack
    module Action
      class CommandTakeSnapshot < Vagrant.plugin("2", :command)
        include Vagrant::Action::Builtin

        def execute
          options = {:openstack_snapshot_name => 'snapshot'}
          opts = OptionParser.new do |opts|
            opts.banner = "Enters openstack"
            opts.separator ""
            opts.separator "Usage: vagrant openstack snapshot <vmname> -n <snapshotname>"


            opts.on( '-n', '--name NAME', 'snapshotname' ) do |name|
              options[:openstack_snapshot_name] = name
            end

          end

          # Parse the options
          argv = parse_options(opts)

          return if !argv


          with_target_vms(argv, :reverse => true) do |vm|
            if vm.provider.to_s == VagrantPlugins::OpenStack::Provider.new(nil).to_s
              vm.action(:take_snapshot,options)
            end
          end
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vagrant-openstack-plugin-tom-0.12.0 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.12.0 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.11.1 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.11.0 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.10.0 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.9.1 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.9.0 lib/vagrant-openstack-plugin/command/command_snapshot.rb
vagrant-openstack-plugin-0.8.0 lib/vagrant-openstack-plugin/command/command_snapshot.rb