Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added VM.host_name and VM.rename #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions esx.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Gem::Specification.new do |s|
s.name = "esx"
s.version = "0.4.4"
s.version = "0.4.6"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Sergio Rubio", "Massimo Maino"]
Expand Down Expand Up @@ -92,4 +92,3 @@ Gem::Specification.new do |s|
s.add_dependency(%q<clamp>, [">= 0"])
end
end

15 changes: 15 additions & 0 deletions lib/esx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ def ip_address
guest_info.ip_address
end

#
# Shortcut to GuestInfo.host_name
#
def host_name
guest_info.host_name
end

def nics
list = []
vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).each do |n|
Expand All @@ -555,6 +562,10 @@ def nics
list
end

def rename(new_name)
vm_object.Rename_Task ({"newName" => new_name})
end

end

class NetworkInterface
Expand Down Expand Up @@ -599,6 +610,10 @@ def ip_address
_wrapped_object.ipAddress
end

def host_name
_wrapped_object.hostName
end

def nics
n = []
_wrapped_object.net.each do |nic|
Expand Down