Sha256: ee008a1dcb4f4904a1748fb264e4ab970a0b06ed383d1cc544dc64c914e11c38

Contents?: true

Size: 877 Bytes

Versions: 4

Compression:

Stored size: 877 Bytes

Contents

module VagrantPlugins
  module VCloudAir
    module Action
      class IsCreated
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new('vagrant_vcloudair::action::is_created')
        end

        def call(env)
          vapp_id = env[:machine].get_vapp_id

          if vapp_id.nil?
            @logger.warn('vApp has not been created')
            env[:result] = false
          else
            @logger.info("vApp has been created and ID is: [#{vapp_id}]")

            vm_id = env[:machine].id
            if vm_id
              @logger.info("VM has been added to vApp and ID is: [#{vm_id}]")
              env[:result] = true
            else
              @logger.warn('VM has not been added to vApp')
              env[:result] = false
            end

          end

          @app.call env
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-vcloudair-0.5.3 lib/vagrant-vcloudair/action/is_created.rb
vagrant-vcloudair-0.5.2 lib/vagrant-vcloudair/action/is_created.rb
vagrant-vcloudair-0.5.1 lib/vagrant-vcloudair/action/is_created.rb
vagrant-vcloudair-0.5.0 lib/vagrant-vcloudair/action/is_created.rb