#506 relax device renumber so it works for an alias
This commit is contained in:
@@ -277,6 +277,8 @@ sub renumber {
|
||||
->update({ip => $new_ip});
|
||||
}
|
||||
|
||||
$schema->resultset('DeviceSkip')
|
||||
->search({device => $new_ip})->delete;
|
||||
$schema->resultset('DeviceSkip')
|
||||
->search({device => $old_ip})
|
||||
->update({device => $new_ip});
|
||||
|
||||
@@ -74,9 +74,9 @@ register 'register_worker' => sub {
|
||||
push @newuserconf, dclone $stanza;
|
||||
}
|
||||
|
||||
# per-device action but no device creds available
|
||||
return $job->add_status( Status->info('skip: driver or action not applicable') )
|
||||
if 0 == scalar @newuserconf;
|
||||
# # per-device action but no device creds available
|
||||
# return $job->add_status( Status->info('skip: driver or action not applicable') )
|
||||
# if 0 == scalar @newuserconf;
|
||||
}
|
||||
|
||||
# back up and restore device_auth
|
||||
|
||||
@@ -28,10 +28,10 @@ register_worker({ phase => 'main' }, sub {
|
||||
my $old_ip = $device->ip;
|
||||
my $new_ip = NetAddr::IP->new($extra);
|
||||
|
||||
my $new_dev = get_device($new_ip->addr);
|
||||
if ($new_dev and $new_dev->in_storage and ($new_dev->ip ne $device->ip)) {
|
||||
return Status->error(sprintf "Already know new device as: %s.", $new_dev->ip);
|
||||
}
|
||||
#my $new_dev = get_device($new_ip->addr);
|
||||
#if ($new_dev and $new_dev->in_storage and ($new_dev->ip ne $device->ip)) {
|
||||
# return Status->error(sprintf "Already know new device as: %s.", $new_dev->ip);
|
||||
#}
|
||||
|
||||
renumber_device($device, $new_ip);
|
||||
return Status->done(sprintf 'Renumbered device %s to %s (%s).',
|
||||
|
||||
@@ -49,9 +49,9 @@ sub run {
|
||||
push @newuserconf, dclone $stanza;
|
||||
}
|
||||
|
||||
# per-device action but no device creds available
|
||||
return $job->add_status( Status->defer('deferred job with no device creds') )
|
||||
if 0 == scalar @newuserconf;
|
||||
# # per-device action but no device creds available
|
||||
# return $job->add_status( Status->defer('deferred job with no device creds') )
|
||||
# if 0 == scalar @newuserconf;
|
||||
}
|
||||
|
||||
# back up and restore device_auth
|
||||
|
||||
Reference in New Issue
Block a user