Skip to content

Commit 3ea8a11

Browse files
vincentbernatpdion891
authored andcommitted
CLOUDSTACK-7195: log wide exceptions in security_group.py
Some try/except in security_group.py catch a lot of exceptions. There was already one fixed in CLOUDSTACK-1052. Here is another one. We use logging.exception() to log those exceptions. Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch> Signed-off-by: Pierre-Luc Dion <pdion891@apache.org>
1 parent b3416f4 commit 3ea8a11

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

scripts/vm/network/security_group.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import xml.dom.minidom
2626
from optparse import OptionParser, OptionGroup, OptParseError, BadOptionError, OptionError, OptionConflictError, OptionValueError
2727
import re
28-
import traceback
2928
import libvirt
3029

3130
logpath = "/var/run/cloud/" # FIXME: Logs should reside in /var/log/cloud
@@ -678,7 +677,7 @@ def get_rule_logs_for_vms():
678677
log = get_rule_log_for_vm(name)
679678
result.append(log)
680679
except:
681-
logging.debug("Failed to get rule logs, better luck next time!")
680+
logging.exception("Failed to get rule logs, better luck next time!")
682681

683682
print ";".join(result)
684683

@@ -883,8 +882,7 @@ def add_network_rules(vm_name, vm_id, vm_ip, signature, seqno, vmMac, rules, vif
883882

884883
return 'true'
885884
except:
886-
exceptionText = traceback.format_exc()
887-
logging.debug("Failed to network rule !: " + exceptionText)
885+
logging.exception("Failed to network rule !")
888886

889887
def getVifs(vmName):
890888
vifs = []

0 commit comments

Comments
 (0)