Re: Module for func using augeas

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

 



> Unified diff are usually a little easier to deal with, if possible ("diff -u" or just "git diff")
Yes, sure, sorry, I've seen this afterwards by looking at posts about patchs on augeas and func lists. I'll do this now.

> Maybe the test scripts could just install some example config
> files to /tmp and not have to set the an AUGEAS_ROOT at all?
Well, it does install config files in /tmp.
For AUGEAS_ROOT, there is a solution:
I call the class Augeas() in augeas.py, and it is possible to set the root there:
def __init__(self, root=None, loadpath=None, flags=NONE):
  ...

The problem is that there are more and more options to pass to the methods in the func augeas module:
set(self,entryPath,param='',pvalue='',hierarchy='/files')
I could also add options like augeasroot and backuptype (newfile/backup/overwrite), but then when you want to set only the last option in the list, you need to set also all the options before (it's ordered, not labeled)

This is not possible with a method in func:
def test(arg1,arg2,arg3='testarg3',arg4='testarg4'):
    print arg1," ",arg2," ",arg3," ",arg4
test('pim','pam',arg4='louis')

Or did I miss something ?

Let me know if you think it is best to add options anyway.

Another option is a conf. file like /etc/defaults/func with something like:
augeas_root=/tmp
augeas_backup=overwrite

But this is ugly and my little module gets intrusive.

Do you know another way to pass some persistent parameters when calling
func.overlord.client.Client() ?



> Whats you'r thoughts on the module name? we could sub module it and make it config.augeas.*.
The sub module with this name config.augeas is fine ! I agree with you that it's more explicit (that is better than implicit...)
And people don't really need to know about augeas to do basic actions, like:
change 'parameter' with 'value' in 'conf_file'
Because the '/file' hierarchy is the default and is masked in the func module.

Raphael Pinson who showed augeas at the fosdem a few days ago told me that augeas was a tool for programmers, not for operators.
But func should be:
- crazy simple to understand
- crazy simple to use
(especially with the WebUI frontend symbolic)
I plan to provide some actions with symbolic to operators, with a strict perimeter for  actions and no sysadmin/scripting skills. I could not do this with SSH+scripting.
So I want to mask the inners as much as possible.
Anyway if people then need more power, they are free to dig with the xpath expressions.
If you're OK with this I'll change the name of the module.

Louis

P.S.: for now on I'll stop putting the augeas-devel list in cc. They now know of the func augeas module and I don't want to pollute their list anymore.


2009/2/23 Adrian LIkins <alikins@xxxxxxxxxx>
Louis Coilliot wrote:
Hello,

I've (mostly) fixed it.

The patch is here:
http://func.pastebin.com/m2bd4d
 
  Unified diff are usually a little easier to deal with, if possible ("diff -u" or just "git diff")


The modified/improved test script is here:
http://func.pastebin.com/m25900459


Modifications on the module:
- fix for trailing /
- new function=backup
(because in func+augeas we can't use /augeas/save; each action is a new
augeas instance)
- new function=getenv


Modifications on the test script:
- the tests are now 'chrooted' with AUGEAS_ROOT
(but you need to put something like export AUGEAS_ROOT='/tmp'
in /etc/init.d/funcd, I don't know yet of a better way to pass this
variable to func)
- new tests, in particular for extended paths
 
  Not sure the best way to test it. Maybe the test scripts could just install some example config
files to /tmp and not have to set the an AUGEAS_ROOT at all?



Todo:
- fix for some extended path failures
- find a way to use /augeas/save in a persistent way
- ability to work on any single conf. file when it will be available in
Augeas
 
I merged and pushed the latest versions. I tested against latest upstream augeas and python-augeas, so
don't know how well it works against say, the F10 augeas.

Whats you'r thoughts on the module name? we could sub module it and make it config.augeas.*. or just
augeas.*. Not sure myself, just augeus.* is short and namespace is probably fine, but it is a little obscure for
someone looking for stuff to change config files if they didn't already know what augeas was. Though, they
kind of need to know what augeas to really make much sense of the module, so maybe thats not that bad.

Adrian


_______________________________________________
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