Re: modules configuration files

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

 



Dnia 2008-10-26, nie o godzinie 14:53 +0100, Luca Foppiano pisze:
> On Sat, 2008-10-18 at 16:43 +0200, Luca Foppiano wrote:
> 
> [...]
> > but right now I don't know how to read the configuration.
> > I'm trying to use ConfigParser but I can't read the configuration
> > through the self.options into the modules...
> 
> 
> I added this method in my module:
> 
>     def version(self):
> 	print self.options.jboss_home
> 	print self.options.jboss_instance
>         return self.options
> 
> and this is my configuration file:
> 
> [root@sboing modules]# cat /etc/func/modules/JBoss.conf
> [main]
> jboss_home=/usr/local/jboss-4.2.2.GA/
> jboss_instance=default
> jboss_interface=127.0.0.1
> 
> and, when I launch func...
> 
> [root@sboing modules]# func "sboing.byte-code.lan" call jboss version
> {'sboing.byte-code.lan': ['REMOTE_ERROR',
>                           'exceptions.AttributeError',
>                           "'Config' object has no attribute
> 'jboss_home'",
>                           '  File
> "/usr/lib/python2.5/site-packages/func/minion/server.py", line 136, in
> __call__\n    rc = self.__method(*args)\n   File
> "/usr/lib/python2.5/site-packages/func/minion/modules/jboss.py", line
> 178, in version\n    print self.options.jboss_home\n']}
> 
> 
> AFAIK my configuration is correct...bug?
You have to create Config class inside your module and decribe the
configuration file. Try adding something like this to your module:

class Config(BaseConfig):
    jboss_home=Option('some default value')
    jboss_instance=Option('default')
    jboss_interface=Option('127.0.0.1')

You can import all needed objects (BaseConfig, Option) from
certmaster.config module.

_______________________________________________
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