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