lib/rbovirt.rb in rbovirt-0.0.1 vs lib/rbovirt.rb in rbovirt-0.0.2

- old
+ new

@@ -95,31 +95,32 @@ http_delete("/templates/%s" % id) end def templates(opts={}) search= opts[:search] || ("datacenter=$s" % current_datacenter.name) - http_get("/templates?serach=%s" % search).xpath('/templates/template').collect do |t| + http_get("/templates?search=%s" % CGI.escape(search)).xpath('/templates/template').collect do |t| OVIRT::Template::new(self, t) end.compact end def template(template_id) template = http_get("/templates/%s" % template_id) OVIRT::Template::new(self, template.root) end def datacenters(opts={}) - datacenters = http_get("/datacenters") + search = opts[:search] ||"" + datacenters = http_get("/datacenters?search=%s" % CGI.escape(search)) datacenters.xpath('/data_centers/data_center').collect do |dc| OVIRT::DataCenter::new(self, dc) end end def clusters(opts={}) headers = {:accept => "application/xml; detail=datacenters"} search= opts[:search] || ("datacenter=$s" % current_datacenter.name) - http_get("/clusters?serach=%s" % search, headers).xpath('/clusters/cluster').collect do |cl| + http_get("/clusters?search=%s" % CGI.escape(search), headers).xpath('/clusters/cluster').collect do |cl| OVIRT::Cluster.new(self, cl) end end def cluster(cluster_id) @@ -146,11 +147,11 @@ OVIRT::Host::new(self, xml_response.root) end def hosts(opts={}) search= opts[:search] || ("datacenter=$s" % current_datacenter.name) - http_get("/hosts?search=%s" % search).xpath('/hosts/host').collect do |h| + http_get("/hosts?search=%s" % CGI.escape(search)).xpath('/hosts/host').collect do |h| OVIRT::Host::new(self, h) end end def storagedomain(sd_id) @@ -158,10 +159,10 @@ OVIRT::StorageDomain::new(self, sd.root) end def storagedomains(opts={}) search= opts[:search] ||'' - http_get("/storagedomains?search=%s" % search).xpath('/storage_domains/storage_domain').collect do |sd| + http_get("/storagedomains?search=%s" % CGI.escape(search)).xpath('/storage_domains/storage_domain').collect do |sd| OVIRT::StorageDomain::new(self, sd) end end private \ No newline at end of file