From 450ebf146f256093deabaee23322a4fd85cd09b9 Mon Sep 17 00:00:00 2001 From: Brian M Date: Fri, 19 Jul 2024 12:59:23 -0700 Subject: [PATCH] Allow dummy-ups driver to be specified --- src/middlewared/middlewared/plugins/ups.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/middlewared/middlewared/plugins/ups.py b/src/middlewared/middlewared/plugins/ups.py index 1743babeea98c..b168cdb34b463 100644 --- a/src/middlewared/middlewared/plugins/ups.py +++ b/src/middlewared/middlewared/plugins/ups.py @@ -17,6 +17,7 @@ RE_TEST_IN_PROGRESS = re.compile(r'ups.test.result:\s*TestInProgress') RE_UPS_STATUS = re.compile(r'ups.status: (.*)') UPS_POWERDOWN_FLAG_FILE = '/etc/killpower' +NUT_DUMMY_UPS = 'dummy-ups' class UPSModel(sa.Model): @@ -168,7 +169,7 @@ async def validate_data(self, data, schema): driver = data.get('driver') if driver: - if driver not in (await self.middleware.call('ups.driver_choices')).keys(): + if driver not in (await self.middleware.call('ups.driver_choices')).keys() and driver != NUT_DUMMY_UPS: verrors.add( f'{schema}.driver', 'Driver selected does not match local machine\'s driver list'