File: push.rb

package info (click to toggle)
vagrant 2.2.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,072 kB
  • sloc: ruby: 80,731; sh: 369; makefile: 9; lisp: 1
file content (33 lines) | stat: -rw-r--r-- 1,023 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'json'
require 'optparse'

require_relative "push_shared"

module VagrantPlugins
  module CommandSnapshot
    module Command
      class Push < Vagrant.plugin("2", :command)
        include PushShared

        def execute
          opts = OptionParser.new do |o|
            o.banner = "Usage: vagrant snapshot push [options] [vm-name]"
            o.separator ""
            o.separator "Take a snapshot of the current state of the machine and 'push'"
            o.separator "it onto the stack of states. You can use `vagrant snapshot pop`"
            o.separator "to restore back to this state at any time."
            o.separator ""
            o.separator "If you use `vagrant snapshot save` or restore at any point after"
            o.separator "a push, pop will still bring you back to this pushed state."
          end

          # Parse the options
          argv = parse_options(opts)
          return if !argv

          return shared_exec(argv, method(:push))
        end
      end
    end
  end
end