Sha256: b2054c5a9099bb9ec01eac5b9b1639585d17cccdf025d537842de7df1e5d7842

Contents?: true

Size: 664 Bytes

Versions: 33

Compression:

Stored size: 664 Bytes

Contents

require 'rbvmomi'
require 'rbvmomi/trollop'

opts = Trollop.options do
  banner <<-EOS
Example 1 from the README: Power on a VM.

Usage:
    readme-1.rb [options] VM name

VIM connection options:
    EOS

    rbvmomi_connection_opts

    text <<-EOS

VM location options:
    EOS

    rbvmomi_datacenter_opt

    text <<-EOS

Other options:
  EOS
end

Trollop.die("must specify host") unless opts[:host]
vm_name = ARGV[0] or abort "must specify VM name"

vim = RbVmomi::VIM.connect opts
dc = vim.serviceInstance.find_datacenter(opts[:datacenter]) or fail "datacenter not found"
vm = dc.find_vm(vm_name) or fail "VM not found"
vm.PowerOnVM_Task.wait_for_completion

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
rbvmomi-1.8.5 examples/readme-1.rb
rbvmomi-1.8.4 examples/readme-1.rb
rbvmomi-1.8.3 examples/readme-1.rb
rbvmomi-1.9.4 examples/readme-1.rb
rbvmomi-1.9.3 examples/readme-1.rb
rbvmomi-1.9.2 examples/readme-1.rb
rbvmomi-1.9.1 examples/readme-1.rb
rbvmomi-1.9.0 examples/readme-1.rb
rbvmomi-1.8.2 examples/readme-1.rb
rbvmomi-1.8.2.pre examples/readme-1.rb
mkuzmin-rbvmomi-1.8.2.1 examples/readme-1.rb
vagrant-rbvmomi-1.8.1 examples/readme-1.rb
rbvmomi-1.8.1 examples/readme-1.rb
rbvmomi-1.8.0 examples/readme-1.rb
gapinc-rbvmomi-1.6.1 examples/readme-1.rb
gapinc-rbvmomi-1.6.0 examples/readme-1.rb
rbvmomi-1.6.0 examples/readme-1.rb
rbvmomi-1.5.1 examples/readme-1.rb
rbvmomi-1.5.0 examples/readme-1.rb
rbvmomi-1.4.0 examples/readme-1.rb