Skip to content

Commit

Permalink
remove unused import and improve logs
Browse files Browse the repository at this point in the history
(cherry picked from commit 47cd536)
  • Loading branch information
yocalebo committed Aug 7, 2024
1 parent 96684f4 commit e85a128
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/middlewared/middlewared/plugins/pool_/replace_disk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import errno
import os

from middlewared.schema import accepts, Bool, Dict, Int, returns, Str
from middlewared.service import item_method, job, Service, ValidationErrors
Expand Down Expand Up @@ -46,11 +45,11 @@ async def replace(self, job, oid, options):
verrors = ValidationErrors()
unused_disks = await self.middleware.call('disk.get_unused')
if not (disk := list(filter(lambda x: x['identifier'] == options['disk'], unused_disks))):
verrors.add('options.disk', 'Disk not found.', errno.ENOENT)
verrors.add('options.disk', f'Disk {options["disk"]!r} not found.', errno.ENOENT)
else:
disk = disk[0]
if not options['force'] and not await self.middleware.call('disk.check_clean', disk['devname']):
verrors.add('options.force', 'Disk is not clean, partitions were found.')
verrors.add('options.force', f'Disk {options["disk"]!r} is not clean, partitions were found.')

if not (found := await self.middleware.call('pool.find_disk_from_topology', options['label'], pool, {
'include_siblings': True,
Expand Down

0 comments on commit e85a128

Please sign in to comment.