From 1d1b95d1e84383bdd6d53ffbd9e0a21b06fece24 Mon Sep 17 00:00:00 2001 From: Timothy Asir Jeyasingh Date: Tue, 24 Jun 2014 15:15:43 +0530 Subject: fix pep8 errors Change-Id: Ia0f570dfb74d6c41484e509f704df12d3b96db17 Signed-off-by: Timothy Asir Jeyasingh Reviewed-on: http://review.gluster.org/8161 Tested-by: Timothy Asir Reviewed-by: Shubhendu Tripathi --- plugins/check_vol_server.py | 38 ++++++------ plugins/config_generator.py | 61 +++++++++--------- plugins/discovery.py | 110 ++++++++++++++++----------------- plugins/hostsnmptrapgenerator.py.in | 12 ++-- plugins/servicesnmptrapgenerator.py.in | 10 +-- tests/testValidation.py | 2 +- tests/testrunner.py | 2 +- 7 files changed, 118 insertions(+), 117 deletions(-) diff --git a/plugins/check_vol_server.py b/plugins/check_vol_server.py index 05b3e2d..8263e6d 100755 --- a/plugins/check_vol_server.py +++ b/plugins/check_vol_server.py @@ -14,7 +14,7 @@ def _getListHosts(hostgroup): table = json.loads(livestatus.readLiveStatusAsJSON( "GET hostgroups\nColumns: members_with_state\n" "Filter: name = " + hostgroup + "\n"))[0][0] - #Get the only those nodes which are UP + # Get the only those nodes which are UP for row in table: if row[1] == utils.HostStatusCode.UP: list_hosts.append(row[0]) @@ -50,10 +50,10 @@ def _getVolGeoRepStatusNRPECommand(volume): return ("check_vol_status -a %s %s" % (volume, 'geo-rep')) -#This function gets the replica pairs -#bricks - list of bricks in the volume -#pair_index - nth pair of replica's needs to be returned -#rCount - replica count +# This function gets the replica pairs +# bricks - list of bricks in the volume +# pair_index - nth pair of replica's needs to be returned +# rCount - replica count def getReplicaSet(bricks, pair_index, rCount): start_index = (pair_index*rCount)-rCount return(bricks[start_index:start_index+rCount]) @@ -74,10 +74,10 @@ def _getVolumeStatusOutput(hostgroup, volume): "Filter: custom_variable_values >= %s\n" "Filter: description ~ Brick - \n" % (hostgroup, volume))) - #output will be as below: - #[[u'Brick - /root/b3', 0, u'10.70.42.246', u'nishanth-rhs-2']] - #parse this to find the no of critical/ok bricks and list of - #critical bricks + # output will be as below: + # [[u'Brick - /root/b3', 0, u'10.70.42.246', u'nishanth-rhs-2']] + # parse this to find the no of critical/ok bricks and list of + # critical bricks bricks_ok = 0 bricks_critical = 0 brick_list_critical = [] @@ -86,8 +86,8 @@ def _getVolumeStatusOutput(hostgroup, volume): bricks_ok += 1 elif brick_detail[1] == utils.PluginStatusCode.CRITICAL: bricks_critical += 1 - #get the critical brick's host uuid if not present - #int the list + # get the critical brick's host uuid if not present + # int the list custom_vars = json.loads(livestatus.readLiveStatusAsJSON( "GET hosts\n" "Columns: custom_variables\n" @@ -99,11 +99,11 @@ def _getVolumeStatusOutput(hostgroup, volume): brick_detail[0][brick_detail[0].find("/"):] brick_dict['uuid'] = custom_vars[0][0]['HOST_UUID'] brick_list_critical.append(brick_dict) - #Get volume details + # Get volume details nrpeStatus, nrpeOut = _executeRandomHost( hostgroup, _getVolDetailNRPECommand(volume)) volInfo = json.loads(nrpeOut) - #Get the volume type + # Get the volume type vol_type = volInfo[volume]['type'] if bricks_ok == 0 and bricks_critical > 0: status = utils.PluginStatusCode.CRITICAL @@ -132,7 +132,7 @@ def _getVolumeStatusOutput(hostgroup, volume): bricks.append( {'brick': brick['brickaddress'] + ":" + brick['brickpath'], 'uuid': brick['hostUuid']}) - #check whether the replica is up for the bricks + # check whether the replica is up for the bricks # which are down rCount = int(volInfo[volume]['replicaCount']) noOfReplicas = len(bricks)/rCount @@ -197,7 +197,7 @@ def _executeRandomHost(hostgroup, command): output = " UNKNOWN: No hosts(with state UP) found in the cluster" return status, output host = random.choice(list_hosts) - #Get the address of the host + # Get the address of the host host_address = _getHostAddress(host) status, output = execNRPECommand(server_utils.getNRPEBaseCommand( @@ -206,10 +206,10 @@ def _executeRandomHost(hostgroup, command): if status != utils.PluginStatusCode.UNKNOWN: return status, output - #random host is not able to execute the command - #Now try to iterate through the list of hosts - #in the host group and send the command until - #the command is successful + # random host is not able to execute the command + # Now try to iterate through the list of hosts + # in the host group and send the command until + # the command is successful for host in list_hosts: status, output = execNRPECommand(server_utils.getNRPEBaseCommand( host, diff --git a/plugins/config_generator.py b/plugins/config_generator.py index a5e52f8..ade3f8c 100644 --- a/plugins/config_generator.py +++ b/plugins/config_generator.py @@ -50,7 +50,7 @@ class GlusterNagiosConfManager: def __init__(self, configDir): self.configDir = configDir - #Create nagios host configuration with the given attributes + # Create nagios host configuration with the given attributes def createHost(self, hostName, alias, template, address, hostGroups, checkCommand, services, uuid): host = {} @@ -62,8 +62,8 @@ class GlusterNagiosConfManager: host['check_command'] = checkCommand if hostGroups: host['hostgroups'] = hostGroups - #Host service is not a field in host configuration. It helps to - #aggregate all the host services under the host + # Host service is not a field in host configuration. It helps to + # aggregate all the host services under the host if services: host[HOST_SERVICES] = services if uuid: @@ -157,7 +157,7 @@ class GlusterNagiosConfManager: service['check_command'] = "gluster_auto_discovery!%s" % (hostIp) return service - #Create all volume related services for the given volume + # Create all volume related services for the given volume def createrVolumeServices(self, volumes, clusterName): volumeServices = [] for volume in volumes: @@ -205,7 +205,7 @@ class GlusterNagiosConfManager: brickService[NOTES] = "Volume : %s" % (brick['volumeName']) return brickService - #Create all Brick related service here. + # Create all Brick related service here. def createBrickServices(self, host): brickServices = [] for brick in host['bricks']: @@ -217,15 +217,15 @@ class GlusterNagiosConfManager: brickServices.append(brickService) return brickServices - #Create a host group with the name + # Create a host group with the name def createHostGroup(self, name): return {'hostgroup_name': name, 'alias': name} - #Create the Nagios configuration model in run time using list and - #dictionary - #Nagios config model hierarchy + # Create the Nagios configuration model in run time using list and + # dictionary + # Nagios config model hierarchy ######################################################################### - #Hostgroup + # Hostgroup # --'_host' ---> List of host configurations in the host group # --'host_services' ----> List of services in the host ######################################################################### @@ -242,13 +242,13 @@ class GlusterNagiosConfManager: cluster['name'])) clusterServices.append(self.createClusterAutoConfigService( cluster['name'], cluster['hosts'][0]['hostip'])) - #Create host config for Gluster cluster with volume related services + # Create host config for Gluster cluster with volume related services clusterHostConfig = self.createHost( cluster['name'], cluster['name'], "gluster-cluster", cluster['name'], None, None, clusterServices, None) hostsConfigs.append(clusterHostConfig) - #Create host config for all hosts in the cluster with brick related - #services + # Create host config for all hosts in the cluster with brick related + # services for host in cluster['hosts']: if host['status'] == HostStatus.CONNECTED: brickServices = self.createBrickServices(host) @@ -261,13 +261,13 @@ class GlusterNagiosConfManager: hostGroup["_hosts"] = hostsConfigs return hostGroup - #Get the config file name for the given hostname + # Get the config file name for the given hostname def getCfgFileName(self, hostname): return self.configDir + "/" + hostname + ".cfg" - #Create Nagios config service for the given host group with all hosts. - #Host group should contain the delta to be written to the configuration. - #Delta will be processed using the change mode. + # Create Nagios config service for the given host group with all hosts. + # Host group should contain the delta to be written to the configuration. + # Delta will be processed using the change mode. def writeHostGroup(self, hostgroup): changeMode = hostgroup[CHANGE_MODE] if changeMode == CHANGE_MODE_ADD: @@ -277,23 +277,23 @@ class GlusterNagiosConfManager: hostgroupModel.set_filename( self.getCfgFileName(hostgroup['hostgroup_name'])) hostgroupModel.save() - #Process all the hosts in the hostgroup. ChangeMode of the hostgroup - #will be used to proces the host if there is not changeMode specified - #in the host. + # Process all the hosts in the hostgroup. ChangeMode of the hostgroup + # will be used to proces the host if there is not changeMode specified + # in the host. if hostgroup['_hosts']: self.writeHosts(hostgroup['_hosts'], changeMode) - #Fill the pynag model with the given values. - #'changeMode' and 'host_services' are special fields which are - #not meant to be writen to the nagios config, These fields are - #used to represent the config model and changes. + # Fill the pynag model with the given values. + # 'changeMode' and 'host_services' are special fields which are + # not meant to be writen to the nagios config, These fields are + # used to represent the config model and changes. def fillModel(self, model, values): for key, value in values.iteritems(): if key not in [CHANGE_MODE, HOST_SERVICES]: model[key] = value return model - #Write service to nagios config + # Write service to nagios config def writeService(self, service, hostname): if service[CHANGE_MODE] == CHANGE_MODE_ADD: serviceModel = Model.Service() @@ -313,16 +313,17 @@ class GlusterNagiosConfManager: self.fillModel(serviceModel, service) serviceModel.save() - #Write all services in the host. - #host_services filed contains the list of services to be written to - #nagios configuration + # Write all services in the host. + # host_services filed contains the list of services to be written to + # nagios configuration def writeHostServices(self, host): for service in host[HOST_SERVICES]: if service.get(CHANGE_MODE) is None: service[CHANGE_MODE] = host[CHANGE_MODE] self.writeService(service, host['host_name']) - #Write the host configuration with list of services to nagios configuration + # Write the host configuration with list of services + # to nagios configuration def writeHost(self, host): if host[CHANGE_MODE] == CHANGE_MODE_REMOVE: hostModel = Model.Host.objects.filter( @@ -345,6 +346,6 @@ class GlusterNagiosConfManager: host[CHANGE_MODE] = chageMode self.writeHost(host) - #Write the hostgroup delta to nagios configuration. + # Write the hostgroup delta to nagios configuration. def generateConfigFiles(self, delta): self.writeHostGroup(delta) diff --git a/plugins/discovery.py b/plugins/discovery.py index 90a9e50..698873e 100755 --- a/plugins/discovery.py +++ b/plugins/discovery.py @@ -40,10 +40,10 @@ from config_generator import HOST_SERVICES from config_generator import GLUSTER_AUTO_CONFIG -#Discovers volumes info one by one. -#First it fetches the volumes list and then it fetches the bricks -#details of volume one by one. Its an work around for size limitation issue -#in NRPE. +# Discovers volumes info one by one. +# First it fetches the volumes list and then it fetches the bricks +# details of volume one by one. Its an work around for size limitation issue +# in NRPE. def discoverVolumes(hostip, timeout): resultDict = {'volumes': []} volumeList = server_utils.execNRPECommand(hostip, @@ -84,23 +84,23 @@ def discoverCluster(hostip, cluster, timeout): """ clusterdata = {} - #Discover the logical components + # Discover the logical components componentlist = discoverVolumes(hostip, timeout) - #Discover the peers + # Discover the peers hostlist = server_utils.execNRPECommand(hostip, "discoverpeers", timeout=timeout) - #Add the ip address of the root node given by the user to the peer list + # Add the ip address of the root node given by the user to the peer list hostlist[0]['hostip'] = hostip for host in hostlist: - #Get host names for all the connected hosts + # Get host names for all the connected hosts if host['status'] == HostStatus.CONNECTED: hostDetails = server_utils.execNRPECommand( host['hostip'], "discoverhostparams", timeout=timeout) host.update(hostDetails) - #Get the list of bricks for this host and add to dictionary + # Get the list of bricks for this host and add to dictionary host['bricks'] = [] for volume in componentlist['volumes']: for brick in volume['bricks']: @@ -110,10 +110,10 @@ def discoverCluster(hostip, cluster, timeout): clusterdata['hosts'] = hostlist clusterdata['volumes'] = componentlist['volumes'] clusterdata['name'] = cluster - #Host names returned by "discoverhostparams" supposed to be unique. So host - #name can be used to configure the host_name in nagios host. - #But if host names are not unique then we have to use IP address to - #configure host_name in nagios. + # Host names returned by "discoverhostparams" supposed to be unique. + # So host name can be used to configure the host_name in nagios host. + # But if host names are not unique then we have to use IP address to + # configure host_name in nagios. if not isHostsNamesUnique(clusterdata): setHostNameWithIP(clusterdata) return clusterdata @@ -146,7 +146,7 @@ def getConfigManager(args): return configManager -#Find the given service in service list. +# Find the given service in service list. def findServiceInList(serviceList, serviceDescription): for service in serviceList: if service['service_description'] == serviceDescription: @@ -154,7 +154,7 @@ def findServiceInList(serviceList, serviceDescription): return None -#Find the given host in host list +# Find the given host in host list def findHostInList(hostList, hostName): for host in hostList: if host['host_name'] == hostName: @@ -162,12 +162,12 @@ def findHostInList(hostList, hostName): return None -#Find all deleted services in the host. +# Find all deleted services in the host. def findDeletedServices(host): deletedService = [] serviceConfigs = server_utils.getServiceConfigByHost(host['host_name']) for serviceConfig in serviceConfigs: - #Consider only the service generated by autoconfig + # Consider only the service generated by autoconfig if not serviceConfig[GENERATED_BY_AUTOCONFIG]: continue service = findServiceInList(host.get(HOST_SERVICES, []), @@ -179,9 +179,9 @@ def findDeletedServices(host): return deletedService -#Looks for changes in the interesting service config fields. These fields -#will be force synced without preserving user changes. All these fields -#are list as part of config_generator.SERVICE_FIELDS_TO_FORCE_SYNC +# Looks for changes in the interesting service config fields. These fields +# will be force synced without preserving user changes. All these fields +# are list as part of config_generator.SERVICE_FIELDS_TO_FORCE_SYNC def findChangeInService(newService, oldService): changes = {} for field in SERVICE_FIELDS_TO_FORCE_SYNC: @@ -195,8 +195,8 @@ def findChangeInService(newService, oldService): return changes -#Check if auto config is changed. IP address in the check command will change -#when user runs the auto config using different host. +# Check if auto config is changed. IP address in the check command will change +# when user runs the auto config using different host. def findChangeInAutoConfig(newService, oldService): newHostIp = newService['check_command'].split('!')[1] oldHostIp = oldService['check_command'].split('!')[1] @@ -212,10 +212,10 @@ def findChangeInAutoConfig(newService, oldService): return None -#Find all Added/Updated/Deleted services in the given host. -#Note: 'Cluster Auto Config' is a special service. When user runs the -#auto-config using different host instead what is used previously then we -#have to update the host ip in existing auto-config service. +# Find all Added/Updated/Deleted services in the given host. +# Note: 'Cluster Auto Config' is a special service. When user runs the +# auto-config using different host instead what is used previously then we +# have to update the host ip in existing auto-config service. def findServiceDelta(host): serviceDelta = [] for service in host.get(HOST_SERVICES, []): @@ -236,7 +236,7 @@ def findServiceDelta(host): return serviceDelta -#Find newly added hosts and newly added services to the existing hosts +# Find newly added hosts and newly added services to the existing hosts def findAddUpdateHosts(hosts): delta = [] for host in hosts: @@ -253,7 +253,7 @@ def findAddUpdateHosts(hosts): return delta -#Find deleted hosts in the given cluster. +# Find deleted hosts in the given cluster. def findDeletedHosts(hostgroup, hosts, ignoredHosts): deletedHosts = [] hostConfigs = server_utils.getHostConfigsForCluster(hostgroup) @@ -266,7 +266,7 @@ def findDeletedHosts(hostgroup, hosts, ignoredHosts): return deletedHosts -#Find Added/Deleted/Updated hosts in cluster +# Find Added/Deleted/Updated hosts in cluster def findHostDelta(clusterConfig, ignoredHosts): hostDelta = [] updated = findAddUpdateHosts(clusterConfig['_hosts']) @@ -276,7 +276,7 @@ def findHostDelta(clusterConfig, ignoredHosts): return hostDelta -#Find changes to the cluster +# Find changes to the cluster def findDelta(clusterConfig, ignoredHosts): delta = {} delta['hostgroup_name'] = clusterConfig['hostgroup_name'] @@ -321,7 +321,7 @@ def parse_input(): return args -#Clean the config directory +# Clean the config directory def cleanConfigDir(dir): if os.path.exists(dir): # Deleting the config dir to write new configs @@ -329,8 +329,8 @@ def cleanConfigDir(dir): os.mkdir(dir) -#Create a summary for mail notification. "\n" should be preserved in the -#string to get the proper format in mail. +# Create a summary for mail notification. "\n" should be preserved in the +# string to get the proper format in mail. def getSummary(clusterDelta): summary = "\nChanges :" clusterChangeMode = clusterDelta[CHANGE_MODE] @@ -357,15 +357,15 @@ def formatTextForMail(text): return output -#Configure the gluster node to send passive check results through NSCA +# Configure the gluster node to send passive check results through NSCA def configureNodes(clusterDelta, nagiosServerAddress, mode, timeout): for host in clusterDelta['_hosts']: - #Only when a new node is added or whole cluster is added freshly. + # Only when a new node is added or whole cluster is added freshly. if (clusterDelta.get(CHANGE_MODE) == CHANGE_MODE_ADD or host.get(CHANGE_MODE) == CHANGE_MODE_ADD) \ and (host['use'] == 'gluster-host'): if not nagiosServerAddress: - #Nagios server address should be specified as arg in auto mode + # Nagios server address should be specified as arg in auto mode if mode == "manual": nagiosServerAddress = getNagiosAddress( clusterDelta['hostgroup_name']) @@ -374,9 +374,9 @@ def configureNodes(clusterDelta, nagiosServerAddress, mode, timeout): "'auto' mode" sys.exit(utils.PluginStatusCode.CRITICAL) - #Configure the nodes. clusterName, Nagios server address and - #host_name is passed as an argument to nrpe command - #'configure_gluster_node' + # Configure the nodes. clusterName, Nagios server address and + # host_name is passed as an argument to nrpe command + # 'configure_gluster_node' server_utils.execNRPECommand( host['address'], 'configure_gluster_node', arguments=[clusterDelta['hostgroup_name'], @@ -387,22 +387,22 @@ def configureNodes(clusterDelta, nagiosServerAddress, mode, timeout): return nagiosServerAddress -#We have to update the cluster auto config service with the nagios -#server address. This is needed for the auto config to configure nodes in -#'auto' mode. +# We have to update the cluster auto config service with the nagios +# server address. This is needed for the auto config to configure nodes in +# 'auto' mode. def updateNagiosAddressInAutoConfig(clusterHostConfig, nagiosServerAddress): autoConfigService = findServiceInList(clusterHostConfig[HOST_SERVICES], GLUSTER_AUTO_CONFIG) if autoConfigService and nagiosServerAddress: checkCommandParams = autoConfigService['check_command'].split("!") if len(checkCommandParams) == 2: - #Nagios server address will the 3rd param + # Nagios server address will the 3rd param checkCommandParams.append(nagiosServerAddress) autoConfigService['check_command'] = "!".join(checkCommandParams) -#Write the cluster configurations. If force mode is used then it will clean -#the config directory before writing the changes. +# Write the cluster configurations. If force mode is used then it will clean +# the config directory before writing the changes. def writeDelta(clusterDelta, configManager, force, @@ -413,7 +413,7 @@ def writeDelta(clusterDelta, nagiosServerAddress, mode, timeout) - #Find the cluster host using host group name + # Find the cluster host using host group name clusterHostConfig = findHostInList(clusterDelta['_hosts'], clusterDelta['hostgroup_name']) if clusterHostConfig: @@ -424,8 +424,8 @@ def writeDelta(clusterDelta, def getNagiosAddress(clusterName): - #If there is an auto config service exist for the cluster, then we have - #to use the previously entered nagios server address + # If there is an auto config service exist for the cluster, then we have + # to use the previously entered nagios server address autoConfigService = server_utils.getServiceConfig(GLUSTER_AUTO_CONFIG, clusterName) if autoConfigService: @@ -465,7 +465,7 @@ def getConfirmation(message, default): return False -#Send a custom notification about the config changes to admin +# Send a custom notification about the config changes to admin def sendCustomNotification(cluster, summary): now = datetime.datetime.now() cmdStr = "[%s] SEND_CUSTOM_SVC_NOTIFICATION;%s;%s;0;" \ @@ -490,7 +490,7 @@ def _getHostGroupNames(hostConfig): def _findDuplicateHost(hosts, clusterName): for host in hosts: - #Host name may be empty if the host is in disconnected status + # Host name may be empty if the host is in disconnected status if host.get('hostname'): hostConfig = server_utils.getHostConfigByName(host.get('hostname')) if hostConfig: @@ -524,8 +524,8 @@ if __name__ == '__main__': if clusterDelta.get(CHANGE_MODE) is None: print "Cluster configurations are in sync" sys.exit(utils.PluginStatusCode.OK) - #When auto config is run in manual mode, we will ask confirmation - #before writing the config file and before restarting the Nagios + # When auto config is run in manual mode, we will ask confirmation + # before writing the config file and before restarting the Nagios if args.mode == "manual": print "Cluster configurations changed" print getSummary(clusterDelta) @@ -549,8 +549,8 @@ if __name__ == '__main__': ) except Exception as e: pass - #If Nagios is running then try to restart. Otherwise don't do - #anything. + # If Nagios is running then try to restart. Otherwise don't do + # anything. if server_utils.isNagiosRunning(): confirmation = getConfirmation( "Do you want to restart Nagios to start monitoring newly " @@ -560,7 +560,7 @@ if __name__ == '__main__': print "Nagios re-started successfully" else: print "Start the Nagios service to monitor" - #auto mode means write the configurations without asking confirmation + # auto mode means write the configurations without asking confirmation elif args.mode == "auto": removed_hosts_count = getRemovedHostsCount(clusterDelta) if removed_hosts_count > 0: diff --git a/plugins/hostsnmptrapgenerator.py.in b/plugins/hostsnmptrapgenerator.py.in index a358de1..ca6c08f 100755 --- a/plugins/hostsnmptrapgenerator.py.in +++ b/plugins/hostsnmptrapgenerator.py.in @@ -1,6 +1,6 @@ #!/usr/bin/python # hostsnmptrapgenerator.py.in -- nagios plugin for generating the -#SNMP traps on host status change +# SNMP traps on host status change # Copyright (C) 2014 Red Hat Inc # # This program is free software; you can redistribute it and/or @@ -85,19 +85,19 @@ def parse_input(): def formatargs(args): - #convert nHostNotifyType to enum value + # convert nHostNotifyType to enum value hostnotifytype = {'problem': '0', 'recovery': '1', 'acknowledgement': '2', 'flappingstart': '3', 'flappingstop': '4'} args.nHostNotifyType = hostnotifytype[args.nHostNotifyType.lower()] - #convert nHostStateType to enum value + # convert nHostStateType to enum value hoststatetype = {'hard': '0', 'soft': '1'} args.nHostStateType = hoststatetype[args.nHostStateType.lower()] - #Add quotes to string parameters to handle - #parameters with multiple words separated with - #spaces + # Add quotes to string parameters to handle + # parameters with multiple words separated with + # spaces args.nHostname = '''"''' + args.nHostname + '''"''' args.nHostGroupName = '''"''' + args.nHostGroupName + '''"''' args.nHostOutput = '''"''' + args.nHostOutput + '''"''' diff --git a/plugins/servicesnmptrapgenerator.py.in b/plugins/servicesnmptrapgenerator.py.in index 66707d2..9f3f388 100755 --- a/plugins/servicesnmptrapgenerator.py.in +++ b/plugins/servicesnmptrapgenerator.py.in @@ -1,6 +1,6 @@ #!/usr/bin/python # servicesnmptrapgenerator.py.in -- nagios plugin for generating the -#SNMP traps on service status change +# SNMP traps on service status change # Copyright (C) 2014 Red Hat Inc # # This program is free software; you can redistribute it and/or @@ -86,16 +86,16 @@ def buildandsendsnmptrap(args): def formatargs(args): - #convert nSvcNotifyType to enum value + # convert nSvcNotifyType to enum value svcnotifytype = {'problem': '0', 'recovery': '1', 'acknowledgement': '2', 'flappingstart': '3', 'flappingstop': '4'} args.nSvcNotifyType = svcnotifytype[args.nSvcNotifyType.lower()] - #Add quotes to string parameters to handle - #parameters with multiple words separated with - #spaces + # Add quotes to string parameters to handle + # parameters with multiple words separated with + # spaces args.nHostname = '''"''' + args.nHostname + '''"''' args.nSvcDesc = '''"''' + args.nSvcDesc + '''"''' args.nSvcGroupName = '''"''' + args.nSvcGroupName + '''"''' diff --git a/tests/testValidation.py b/tests/testValidation.py index b46c9f8..e9d6677 100644 --- a/tests/testValidation.py +++ b/tests/testValidation.py @@ -18,7 +18,7 @@ # Refer to the README and COPYING files for full details of the license # -## This framework is mostly copied from vdsm test framework +# This framework is mostly copied from vdsm test framework import os from nose.plugins.skip import SkipTest diff --git a/tests/testrunner.py b/tests/testrunner.py index 1ee7e35..97aedaf 100644 --- a/tests/testrunner.py +++ b/tests/testrunner.py @@ -18,7 +18,7 @@ # Refer to the README and COPYING files for full details of the license # -## This framework is mostly copied from vdsm test framework +# This framework is mostly copied from vdsm test framework import logging import sys -- cgit