Sha256: 56b80637136d265e48641513e32837ca992a02d2c3917cb6ab79e5931db5d692

Contents?: true

Size: 755 Bytes

Versions: 12

Compression:

Stored size: 755 Bytes

Contents

module VagrantPlugins
  module VCloud
    module Action
      class IsLastVM
        def initialize(app, env)
          @app = app
        end

        def call(env)
          cfg = env[:machine].provider_config
          cnx = cfg.vcloud_cnx.driver

          vapp_id = env[:machine].get_vapp_id

          test_vapp = cnx.get_vapp(vapp_id)

          if test_vapp[:vms_hash].count == 1
          # Set the result to be true if the machine is running.
            env[:result] = true
          else
            env[:result] = false
          end

          # Call the next if we have one (but we shouldn't, since this
          # middleware is built to run with the Call-type middlewares)
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-vcloud-0.5.0 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.7 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.6 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.4 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.3 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.2 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.1 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.4.0 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.3.3 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.3.2 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.3.1 lib/vagrant-vcloud/action/is_last_vm.rb
vagrant-vcloud-0.3.0 lib/vagrant-vcloud/action/is_last_vm.rb