Re: Porting func on gentoo

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

 



Luca Lesinigo wrote:
Il giorno 23/ago/08, alle ore 17:33, Krzysztof A. Adamski ha scritto:
this one seems better suited for a global minion config (could just be a runtime variable - a thing like this should be autodetected and not provided by the user) since it would be the same information for all modules...
I just personally don't like the code looking like this:
if os == 'fedora':
 [...]
elif os == 'gentoo':
 [...]
elif os == 'debian':
 [...]
... with dozen of different cases...
You don't have to do that at every single point of choice in the code.

For example, I'd like to add service support for gentoo services.

func is OOP structured so it could use a python class defining a common interface (that's actually called Interface in other oop languages :) and implement that interface in different classes for the various operating systems.

Agreed, though interfaces are relatively useless in dynamically typed languages. Duck-typing should be sufficient.
The trick will be in writing the loader that gets you the right object.

One thing that is important in all of this is to keep the signature for how things are invoked the same, so we don't break any existing scripts.

The initialization code for a module could select the correct class (and this is the only place where you would put the choose-right-os logic) or raise exception if that particular os isn't supported by that particular module.

Have you got any better idea on how to achieve that? If you really want func to reach outside the fedora world, you'll have to consider this task sooner or later.


To be fair, it's already reaching outside the Fedora world. At least, it is reaching into the RHEL and CentOS worlds :)

Func also runs on Debian and BSD as well. These folks are mostly running "command run" calls, as opposed to the various func sub-modules. In this sense, func is being used as a distributed-SSH-on-steroids, but not so much for it's modules. Getting better module support however is something I'm very interested in, and is where Func can make things even easier than remembering how command lines work on various operating systems and versions. So that is definitely something I'd like to see.

If nothing better comes out, I will probably try that way and propose the results to the list (if/when I'll have something working :)

Excellent!


--
Luca Lesinigo


--
Luca Lesinigo


------------------------------------------------------------------------

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list



_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux