1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #708 from ohadlevy/master

minor cleanup and a couple of bugs
This commit is contained in:
Patrick Debois 2012-01-25 04:35:27 -08:00
commit 89e951177d
4 changed files with 11 additions and 8 deletions

View file

@ -62,7 +62,7 @@ module Fog
end
rescue ::Libvirt::ConnectionError
raise Fog::Errors::Error.new("Error making a connection to libvirt URI #{@uri.uri}:\n#{$!}")
raise Fog::Errors::Error.new("Error making a connection to libvirt URI #{uri.uri}:\n#{$!}")
end
end
@ -86,8 +86,7 @@ module Fog
end
end
end
newuri=uri+append
return newuri
uri+append
end
def respond_to?(method, *)

View file

@ -56,9 +56,13 @@ module Fog
super
end
def new?
uuid.nil?
end
def save
raise Fog::Errors::Error.new('Resaving an existing server may create a duplicate') if uuid
raise Fog::Errors::Error.new('Resaving an existing server may create a duplicate') unless new?
validate_template_options
@ -71,7 +75,7 @@ module Fog
# We either now have xml provided by the user or generated by the template
begin
if xml
self.raw = self.persistent ? connection.raw.define_domain_xml(xml) : connection.raw.create_domain_xml(xml)
self.raw = persistent ? connection.raw.define_domain_xml(xml) : connection.raw.create_domain_xml(xml)
end
rescue
raise Fog::Errors::Error.new("Error saving the server: #{$!}")
@ -226,7 +230,7 @@ module Fog
end
def stopped?
state == "shutdown"
state == "shutoff"
end
def ready?

View file

@ -44,7 +44,8 @@ module Fog
end
def get(uuid)
self.all(:uuid => uuid).first
vm = all(:uuid => uuid)
vm.empty? ? nil : vm.first
end
def bootstrap(new_attributes = {})

View file

@ -19,7 +19,6 @@ module Fog
end
end
end
end
end