OSDN Git Service

------ BUGFIX ------
authorTaizo ITO <taizo@karesansui-project.info>
Fri, 23 Apr 2010 03:39:34 +0000 (12:39 +0900)
committerTaizo ITO <taizo@karesansui-project.info>
Fri, 23 Apr 2010 03:39:34 +0000 (12:39 +0900)
------ BUGZILLA ------

------ TRAC ------

------ IMPROVEMENT ------

------ CREATE ------

------ COMMENT ------
commited.

karesansui/lib/collectd/config.py
karesansui/lib/dict_op.py
karesansui/lib/parser/collectdplugin.py

index fecfeb5..39e8ca3 100644 (file)
@@ -321,16 +321,16 @@ def init_filter(dop=None, webobj=None, host=None):
     load_plugins = ["match_regex","match_value","target_notification"]
 
     if dop.cdp_isset("collectdplugin",[FilterName,"@ORDERS"],multiple_file=True) is True:
-        orders = dop.cdp_get("collectdplugin",[FilterName,"@ORDERS"],multiple_file=True)
+        orders = dop.get("collectdplugin",[FilterName,"@ORDERS"])
     else:
         orders = []
 
     for plugin_name in load_plugins:
         if dop.cdp_isset("collectdplugin",[FilterName,"LoadPlugin",plugin_name],multiple_file=True) is False:
-            dop.cdp_set("collectdplugin",[FilterName,"LoadPlugin",plugin_name],plugin_name,multiple_file=True)
+            dop.cdp_set("collectdplugin",[FilterName,"LoadPlugin",plugin_name],plugin_name,multiple_file=True,is_opt_multi=True)
             orders.append(["LoadPlugin",plugin_name])
 
-    dop.cdp_set("collectdplugin",[FilterName,"@ORDERS"],orders,multiple_file=True)
+    dop.set("collectdplugin",[FilterName,"@ORDERS"],orders)
 
 def set_chain_rule(type,chain,rule,params,dop=None, webobj=None, host=None):
     global DictOp
@@ -604,9 +604,10 @@ if __name__ == '__main__':
     enable_python_plugin()
 
     conf = DictOp.getconf("collectdplugin")
-    preprint_r(conf["filter"])
-    preprint_r(conf["python"])
-    preprint_r(conf["threshold"])
+    preprint_r(conf)
+    #preprint_r(conf["filter"])
+    #preprint_r(conf["python"])
+    #preprint_r(conf["threshold"])
 
     from karesansui.lib.parser.collectdplugin import collectdpluginParser
     parser = collectdpluginParser()
index ec50a28..29025fa 100644 (file)
@@ -114,10 +114,18 @@ class DictOp:
             eval_str_value  = "conf"
 
             if multiple_file is True:
-                eval_str_value  += "['%s']['value']" % new_key.pop(0)
+                file_name = new_key.pop(0)
+                eval_str         = eval_str_value + "['%s']" % file_name
+                eval_str_value  += "['%s']['value']" % file_name
                 try:
                     exec("%s" % (eval_str_value,))
                 except:
+                    #import pdb; pdb.set_trace()
+                    try:
+                        exec("%s" % (eval_str,))
+                    except:
+                        val_str = "{}"
+                        exec("%s = %s" % (eval_str,val_str))
                     val_str = "{}"
                     exec("%s = %s" % (eval_str_value,val_str))
 
index 0987f19..a6b37dc 100644 (file)
@@ -91,7 +91,8 @@ class collectdpluginParser:
                         os.unlink(_afile)
                         #pass
             except:
-                continue
+                pass
+                #continue
 
             try:
                 _v['value']