From e85a128f48c803f378bfb7b2ea55d485917e26d2 Mon Sep 17 00:00:00 2001 From: caleb Date: Tue, 6 Aug 2024 10:50:44 -0400 Subject: [PATCH] remove unused import and improve logs (cherry picked from commit 47cd5366883260f25cbc6fa9a55982f62b8d93dd) --- src/middlewared/middlewared/plugins/pool_/replace_disk.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/middlewared/middlewared/plugins/pool_/replace_disk.py b/src/middlewared/middlewared/plugins/pool_/replace_disk.py index e29402d7bae2f..2fcae0ee225be 100644 --- a/src/middlewared/middlewared/plugins/pool_/replace_disk.py +++ b/src/middlewared/middlewared/plugins/pool_/replace_disk.py @@ -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 @@ -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,