#506 relax device renumber so it works for an alias

This commit is contained in:
Oliver Gorwits
2019-03-02 22:41:40 +00:00
parent 7a8bcb094e
commit ef560fb59a
4 changed files with 12 additions and 10 deletions

View File

@@ -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});

View File

@@ -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

View File

@@ -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).',

View File

@@ -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