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

[Ovirt-devel] Re: Ruby interface for Cobbler XML-RPC APIs.



+++ David Lutterkort [01/08/08 02:21 +0000]:
Still looking for some feedback from anybody with some experience with Ruby.
I'm now working on the save functionality. I'm playing with having each child
class declare a saving script and passing it to the cobbler_save_method code
generator. I'd like some input from anybody on that path.

Why not just decalre a save method straight up in each class ? I don't
see what the metaprogramming there buys you.

I guess I was trying to be a little *too* slick with the programming. For now
I'll take your advice and just do a simple save per class.

+ @attrs +
+    def attributes(name)
+      return @attrs ? @attrs[name] : nil
+    end

Attributes is kinda an overloaded name in Ruby - how about fields or
similar ? Also, should @attrs really be an instance variable rather than
a class variable ?

Yeah. The attrs (I'll rename it to something clearer, maybe
"remote_definition"?) represent the values for that particular
system/distro/profile in the Cobbler server.
+      unless result
+        result = XMLRPC::Client.new2("http://#{@@hostname}/cobbler_api#{writable ? '_rw' : ''}")
+      end
+ + return result
+    end

Don't you want to cache the connection here, i.e. more something like

Not really. Depending on the call, it's either got to go through the
read-only interface or the read-write interface.
Thanks for the input. That's the kind of stuff I need to get this codebase
working cleanly.

--
Darryl L. Pierce, Sr. Software Engineer
Red Hat, Inc. - http://www.redhat.com/
oVirt - Virtual Machine Management - http://www.ovirt.org/
"What do you care what other people think, Mr. Feynman?"

Attachment: pgp2HBCn4q8GQ.pgp
Description: PGP signature


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