From 89981413977258a3f4b28df5208a9474b5112e4d Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Fri, 24 Oct 2008 14:11:08 -0400 Subject: Fix minion module config examples. Add local "Config" class to module. Add in all the approriate types and defaults to Config class Update etc/Test.conf example to include everything in main. For now we only support one stanza config files for modules. updated test cases to test that proper values are fetched from the config file for the "test" module --- func/minion/modules/test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'func') diff --git a/func/minion/modules/test.py b/func/minion/modules/test.py index 4548a84..7c298e2 100644 --- a/func/minion/modules/test.py +++ b/func/minion/modules/test.py @@ -1,12 +1,22 @@ import func_module import time import exceptions +from certmaster.config import BaseConfig, Option, IntOption, FloatOption, BoolOption class Test(func_module.FuncModule): version = "11.11.11" api_version = "0.0.1" description = "Just a very simple example module" + class Config(BaseConfig): + example = Option('1') + string_option = Option('some string here') + int_option = IntOption(37) + bool_option = BoolOption(True) + float_option = FloatOption(3.14159) + testvalue = 'this is a test. It is only a test' + + def add(self, numb1, numb2): return numb1 + numb2 @@ -63,7 +73,7 @@ class Test(func_module.FuncModule): return getattr(self.options, key_name) def config_get_test(self): - return self.options.anothersection.testvalue + return self.options.testvalue def register_method_args(self): """ -- cgit