Skip to content
Snippets Groups Projects
Commit 70694055 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Changed log (refs #22279).

parent a6d54cd9
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ def get_swap_gbytes(): ...@@ -51,7 +51,7 @@ def get_swap_gbytes():
swap = l.split('SwapTotal:')[1].strip() swap = l.split('SwapTotal:')[1].strip()
swap_kbytes, unit = swap.split(' ') swap_kbytes, unit = swap.split(' ')
if unit != 'kB': if unit != 'kB':
print('Warning, unexpected unit %s' % unit) print('Warning, unexpected unit %s.' % unit)
swap_gbytes = int(round(int(swap_kbytes) / (1024 * 1024))) swap_gbytes = int(round(int(swap_kbytes) / (1024 * 1024)))
return swap_gbytes return swap_gbytes
...@@ -87,7 +87,7 @@ def check_allocation(dev): ...@@ -87,7 +87,7 @@ def check_allocation(dev):
unallocated = max_size - total_size unallocated = max_size - total_size
unallocated_gbytes = to_gbytes(unallocated) unallocated_gbytes = to_gbytes(unallocated)
if unallocated_gbytes > 1: if unallocated_gbytes > 1:
print('Warning, %s GB are unallocated on %s' % (unallocated_gbytes, root_dev)) print('Warning, %s GB are unallocated on %s.' % (unallocated_gbytes, root_dev))
return False return False
return True return True
...@@ -107,37 +107,37 @@ def check_path(p): ...@@ -107,37 +107,37 @@ def check_path(p):
name = mount_point name = mount_point
dev, fstype, psize, available = get_path(mount_point) dev, fstype, psize, available = get_path(mount_point)
if fstype not in p.get('recommended_types'): if fstype not in p.get('recommended_types'):
print('Warning, partition of %s fs type not recommended %s(current: %s, recommended: %s)%s' % (name, YELLOW, fstype, p['recommended_types'], DEF)) print('Warning, partition of %s fs type not recommended %s(current: %s, recommended: %s)%s.' % (name, YELLOW, fstype, p['recommended_types'], DEF))
warning = True warning = True
if 'nfs' not in dev: if 'nfs' not in dev:
warning = not check_allocation(dev) warning = not check_allocation(dev)
min_available_gbytes = p.get('min_available_gbytes') min_available_gbytes = p.get('min_available_gbytes')
if min_available_gbytes and available < min_available_gbytes: if min_available_gbytes and available < min_available_gbytes:
print('Partition of %s has less than %s GB available (%s GB available)' % (mount_point, min_available_gbytes, available)) print('Partition of %s has less than %s GB available %s(%s GB available)%s.' % (name, min_available_gbytes, RED, available, DEF))
error = True error = True
else: else:
print('Partition of %s is OK (%s GB available)' % (name, available)) print('Partition of %s is OK (%s GB available).' % (name, available))
else: else:
print('%s not found, cannot check' % mount_point) print('%s not found, cannot check.' % mount_point)
elif p.get('type') == 'swap': elif p.get('type') == 'swap':
name = 'swap' name = 'swap'
psize = get_swap_gbytes() psize = get_swap_gbytes()
if psize and psize < p['min_size_gbytes']: if psize and psize < p['min_size_gbytes']:
print('%s is smaller than the minimum required size %s(%s GB < %s GB)%s' % (name, RED, psize, p['min_size_gbytes'], DEF)) print('Partition of %s is smaller than the minimum required size %s(%s GB < %s GB)%s.' % (name, RED, psize, p['min_size_gbytes'], DEF))
error = True error = True
for p in paths: for p in paths:
check_path(p) check_path(p)
if error: if error:
print('Errors found') print('Errors found.')
code = 1 code = 1
elif warning: elif warning:
print('Some warnings were found') print('Some warnings were found.')
code = 2 code = 2
else: else:
print(GREEN + 'All ok' + DEF) print(GREEN + 'All OK.' + DEF)
code = 0 code = 0
sys.exit(code) sys.exit(code)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment