Blob Blame History Raw
commit c360d3eecf6f9976d3371090034d08d03000f0e1
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date:   Wed Feb 26 09:34:35 2014 +0100

    vmware_soap: drop warning from python suds when error occours
    
    prepatch:
    fence_vmware_soap -z -l test -p wrongpasswd -a blabla -n vm1 -o reboot -v
    No handlers could be found for logger "suds.client"
    Failed: The user does not have the correct privileges to do the requested action.
    
    postpatch:
    fence_vmware_soap -z -l test -p wrongpassed -a blabla -n vm1 -o reboot -v
    Failed: The user does not have the correct privileges to do the requested action.
    
    Based on https://fedorahosted.org/suds/wiki/Documentation
    logging must be configured and filter for CRITICAL since the harmless
    error is at INFO level.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>

diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 400e81f..c73a1d6 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -2,6 +2,7 @@
 
 import sys, exceptions, time
 import shutil, tempfile, suds
+import logging
 sys.path.append("@FENCEAGENTSLIBDIR@")
 
 from suds.client import Client
@@ -199,6 +200,9 @@ Alternatively you can always use UUID to access virtual machine."
 	docs["vendorurl"] = "http://www.vmware.com"
 	show_docs(options, docs)
 
+	logging.basicConfig(level=logging.INFO)
+	logging.getLogger('suds.client').setLevel(logging.CRITICAL)
+
 	##
 	## Operate the fencing device
 	####