Permalink
Browse files

Feng Zhichao: add get methods in cloudstack node

  • Loading branch information...
1 parent a5ceebb commit d0289cb0577253a33b4721c88b487173c8293c35 @flanker flanker committed Feb 15, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/fog/cloudstack/models/compute/servers.rb
@@ -18,13 +18,21 @@ def initialize(attribute)
end
def all(filters = self.filters)
- data = connection.list_virtual_machines.body
+ data = connection.list_virtual_machines(filters).body
load(
data['virtualMachines'].map do |instance|
instance
end.flatten
)
end
+
+ def get(server_id)
+ if server_id
+ self.class.new(:connection => connection).all('id' => server_id).first
+ end
+ rescue Fog::Errors::NotFound
+ nil
+ end
end
end
end

0 comments on commit d0289cb

Please sign in to comment.