2023-07-12 09:01:20 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    use MIME::Base64 qw(encode_base64);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-14 23:46:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # migrate old
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-14 23:06:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $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');
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-12 09:01:20 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $nutrec->set_prop('AdminPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('AdminPass');
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-14 23:06:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # 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'));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-12 09:01:20 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |