* Tue Mar 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme

- update config for Nut 2.8.2 [SME: 12657]
  TODO review master/slave mode
  TODO convert master/slave to primary/secondary
  TODO convert to new config data + migrate
  TODO event and action
This commit is contained in:
2025-05-14 23:06:09 -04:00
parent 30dcc4861f
commit a768594f0f
34 changed files with 292 additions and 108 deletions

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
3493

View File

@@ -1 +1 @@
service
configuration

View File

@@ -2,7 +2,21 @@
use MIME::Base64 qw(encode_base64);
my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
$nutrec->set_prop('MasterPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('MasterPass');
$nutrec->set_prop('SlavePass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SlavePass');
  # migrate old
$nutrec->set_prop('PrimaryPass',$DB->get_prop_and_delete('nut', MasterPass)) if (exists $nut{'MasterPass'});
$nutrec->set_prop('SecondaryPass',$DB->get_prop_and_delete('nut', SlavePass)) if (exists $nut{'SlavePass'});
$nutrec->set_prop('PrimaryPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('PrimaryPass');
$nutrec->set_prop('SecondaryPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SecondaryPass');
$nutrec->set_prop('AdminPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('AdminPass');
# if $nut{SlaveUPS} defined we set and the target not existing ClientUPS ; then delete SlaveUPS
# set ClientUser as upsslave (was the content before sme11) intended for smooth migration
# set ClientPass as $nut{SlavePass}/{SecondaryPass}
if ( $nut{'SlaveUPS'} ) {
$nutrec->set_prop('ClientUPS',$DB->get_prop_and_delete('nut','SlaveUPS') ) if not $nut{'ClientUPS'};
$nutrec->set_prop('ClientUser','upsslave');
$nutrec->set_prop('ClientPass',$nutrec->prop('SecondaryPass'));
}
}