[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Ovirt-devel] [PATCH 5/5] Sample code that shows how to use the API



On Thu, 2008-08-07 at 16:51 -0400, Scott Seago wrote:
> David Lutterkort wrote:
> > diff --git a/wui/client/lib/ovirt.rb b/wui/client/lib/ovirt.rb
> > new file mode 100644
> > index 0000000..48739f4
> > --- /dev/null
> > +++ b/wui/client/lib/ovirt.rb
> > @@ -0,0 +1,63 @@
> > +require 'pp'
> > +require 'rubygems'
> > +require 'activeresource'
> > +
> > +module OVirt
> > +    class Base < ActiveResource::Base ; end
> > +
> > +    class HardwarePool < Base
> > +        def self.find_by_path(path)
> > +            find(:first, :params => { :path => path })
> > +        end
> > +
> > +        def self.default_pool
> > +            find(:first, :params => { :path => "/default" })
> > +        end
> > +    end
> > +
> >   
> We shouldn't rely on the fact that the default pool is named 'default'. 
> This is probably an issue with Pool.find_by_path as well. Although an 
> admin can't delete the default pool, he can rename it. 
> Pool.get_default_pool will return the right pool regardless of its name 
> though.

Agreed ... would looking for the pool with id 1 be better ? Or should
the fact that you want the root pool be communicated entirely
differently ?

David



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]