Skip to content

Commit

Permalink
Allow dummy-ups driver to be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeagherix committed Jul 19, 2024
1 parent 36643a9 commit 450ebf1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middlewared/middlewared/plugins/ups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 450ebf1

Please sign in to comment.