Sha256: 10361eeb3c9d8511c7b4cb2fcf3510b0512f896cab809cb2d8c231e0bf08fc26

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

require "vagrant/action/builder"

module HashiCorp

    module VagrantVMwareworkstation

        module Action

            autoload :SnapshotTake,              File.expand_path("../action/snapshot_take.rb", __FILE__)
            autoload :SnapshotRollback,          File.expand_path("../action/snapshot_rollback.rb", __FILE__)
            autoload :HasSnapshot,               File.expand_path("../action/has_snapshot.rb", __FILE__)
            autoload :MessageSnapshotNotCreated, File.expand_path("../action/message_snapshot_not_created.rb", __FILE__)

            def self.action_snapshot_take
                Vagrant::Action::Builder.new.tap do |b|
                    b.use CheckVMware
                    b.use Call, Created do |env, b2|
                        if env[:result]
                            b2.use SnapshotTake
                        else
                            b2.use MessageNotCreated
                        end
                    end
                end
            end

            def self.action_snapshot_rollback
                Vagrant::Action::Builder.new.tap do |b|
                    b.use CheckVMware
                    b.use Call, Created do |env, b2|
                        if env[:result]
                            b2.use Call, HasSnapshot do |env2, b3|
                                if env2[:result]
                                    b3.use SnapshotRollback
                                    b3.use WaitForCommunicator, [:restoring, :running]
                                else
                                    b3.use MessageSnapshotNotCreated
                                end
                            end
                        else
                            b2.use MessageNotCreated
                        end
                    end
                end
            end
       end

    end

end

        

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-multiprovider-snap-0.0.12 lib/vagrant-multiprovider-snap/providers/vmware_workstation/action.rb
vagrant-multiprovider-snap-0.0.11 lib/vagrant-multiprovider-snap/providers/vmware_workstation/action.rb