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:
commit
89e951177d
4 changed files with 11 additions and 8 deletions
|
@ -62,7 +62,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue ::Libvirt::ConnectionError
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -86,8 +86,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
newuri=uri+append
|
uri+append
|
||||||
return newuri
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def respond_to?(method, *)
|
def respond_to?(method, *)
|
||||||
|
|
|
@ -56,9 +56,13 @@ module Fog
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new?
|
||||||
|
uuid.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def save
|
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
|
validate_template_options
|
||||||
|
|
||||||
|
@ -71,7 +75,7 @@ module Fog
|
||||||
# We either now have xml provided by the user or generated by the template
|
# We either now have xml provided by the user or generated by the template
|
||||||
begin
|
begin
|
||||||
if xml
|
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
|
end
|
||||||
rescue
|
rescue
|
||||||
raise Fog::Errors::Error.new("Error saving the server: #{$!}")
|
raise Fog::Errors::Error.new("Error saving the server: #{$!}")
|
||||||
|
@ -226,7 +230,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def stopped?
|
def stopped?
|
||||||
state == "shutdown"
|
state == "shutoff"
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
|
|
|
@ -44,7 +44,8 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(uuid)
|
def get(uuid)
|
||||||
self.all(:uuid => uuid).first
|
vm = all(:uuid => uuid)
|
||||||
|
vm.empty? ? nil : vm.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def bootstrap(new_attributes = {})
|
def bootstrap(new_attributes = {})
|
||||||
|
|
|
@ -19,7 +19,6 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue