Fix coding style

This commit is contained in:
Thomas Gebert 2024-12-10 09:47:04 +01:00
parent f72fabaae7
commit 1cde979a3d

View File

@ -11,28 +11,24 @@ import sys
################################################################################ ################################################################################
# Global variables and defaults # Global variables and defaults
################################################################################ ################################################################################
iointerfaces_allowed = [ iointerfaces_allowed = ['async',
'async',
'cached', 'cached',
'direct', 'direct',
'sync', 'sync',
'dsync' 'dsync']
]
ioping_arguments = { ioping_arguments = {'location': '',
'location': '',
'cmd': 'ioping --batch', 'cmd': 'ioping --batch',
'count': '10', 'count': '10',
'interval': '1s', 'interval': '1s',
'options': '' 'options': ''}
}
################################################################################ ################################################################################
# Global functions # Global functions
################################################################################ ################################################################################
# Function to run the shell command and capture outputs and returncode # Function to run the shell command and capture outputs and returncode
def capture_ioping_results(): def capture_ioping_results():
if ioping_arguments['location'] == '': if ioping_arguments['location'] == '':
return 1, '', 'No ioping_locationectory given.' return 1, '', 'No ioping_locationectory given.'
@ -58,6 +54,7 @@ def ioping_output_shell():
print(stdout) print(stdout)
else: else:
print(stderr) print(stderr)
return returncode return returncode
@ -69,8 +66,7 @@ def ioping_output_telegraf():
print(stderr) print(stderr)
return returncode return returncode
ioping_statistic_keys = [ ioping_statistic_keys = ['statistics_count',
'statistics_count',
'runtime', 'runtime',
'iops', 'iops',
'transfer_speed', 'transfer_speed',
@ -79,8 +75,7 @@ def ioping_output_telegraf():
'max_request_time', 'max_request_time',
'std_deviation_request_time', 'std_deviation_request_time',
'total_requests', 'total_requests',
'total_running_time' 'total_running_time']
]
try: try:
ioping_statistics = dict(zip(ioping_statistic_keys, stdout.split())) ioping_statistics = dict(zip(ioping_statistic_keys, stdout.split()))
@ -131,7 +126,6 @@ def main():
if args.iointerface in iointerfaces_allowed: if args.iointerface in iointerfaces_allowed:
ioping_arguments['options'] += '--%s ' % args.iointerface ioping_arguments['options'] += '--%s ' % args.iointerface
if args.mode == 'shell': if args.mode == 'shell':
returncode = ioping_output_shell() returncode = ioping_output_shell()
elif args.mode == 'telegraf': elif args.mode == 'telegraf':