From 7ea95134c314e28de2ba9873658f37d02532eb0b Mon Sep 17 00:00:00 2001 From: "Mark A. Ziesemer" Date: Tue, 26 Jun 2018 10:22:13 -0500 Subject: [PATCH] Source code syntax / comment formatting updates. - Compact comments regarding switch states. - Update except to use "as" to minimize future changeset for a Python 3 version. --- check_cisco_stack.py | 50 +++++++++++++------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/check_cisco_stack.py b/check_cisco_stack.py index 9ff00e5..1d7c536 100755 --- a/check_cisco_stack.py +++ b/check_cisco_stack.py @@ -277,7 +277,7 @@ def parse_args(): "community=", "snmp-protocol-version=" ] + snmp_kwargs_listopts) - except getopt.GetoptError, err: + except getopt.GetoptError as err: # print help information and exit: print(str(err)) # will print something like "option -a not recognized" usage() @@ -427,40 +427,20 @@ def get_stack_info(options): # http://tools.cisco.com/Support/SNMP/do/BrowseOID.do? # objectInput=1.3.6.1.4.1.9.9.500.1.2.1.1.6&translate=Translate&submitValue=SUBMIT # -# -# "The current state of a switch: -# -# waiting - Waiting for a limited time on other -# switches in the stack to come online. -# -# progressing - Master election or mismatch checks in -# progress. -# -# added - The switch is added to the stack. -# -# ready - The switch is operational. -# -# sdmMismatch - The SDM template configured on the master -# is not supported by the new member. -# -# verMismatch - The operating system version running on the -# master is different from the operating -# system version running on this member. -# -# featureMismatch - Some of the features configured on the -# master are not supported on this member. -# -# newMasterInit - Waiting for the new master to finish -# initialization after master switchover -# (Master Re-Init). -# -# provisioned - The switch is not an active member of the -# stack. -# -# invalid - The switch's state machine is in an -# invalid state. -# -# removed - The switch is removed from the stack." +# The current state of a switch: +# - waiting - Waiting for a limited time on other switches in the stack to come online. +# - progressing - Master election or mismatch checks in progress. +# - added - The switch is added to the stack. +# - ready - The switch is operational. +# - sdmMismatch - The SDM template configured on the master is not supported by the new member. +# - verMismatch - The operating system version running on the master is different from the operating +# system version running on this member. +# - featureMismatch - Some of the features configured on the master are not supported on this member. +# - newMasterInit - Waiting for the new master to finish initialization after master switchover +# (Master Re-Init). +# - provisioned - The switch is not an active member of the stack. +# - invalid - The switch's state machine is in an invalid state. +# - removed - The switch is removed from the stack. def stack_state(x): return stackStates.get(x, "UNKNOWN")