initial commit of file from CVS for e-smith-hosts on Wed 12 Jul 08:56:08 BST 2023
This commit is contained in:
22
root/etc/e-smith/db/hosts/migrate/10sanitise-db
Normal file
22
root/etc/e-smith/db/hosts/migrate/10sanitise-db
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
foreach my $host ($DB->get_all)
|
||||
{
|
||||
my $lc_key = lc($host->key);
|
||||
|
||||
next if ( $lc_key eq $host->key );
|
||||
|
||||
my $rec = $DB->get($lc_key);
|
||||
|
||||
if ($rec)
|
||||
{
|
||||
warn "HostsDB: " . $host->key .
|
||||
" NOT migrated as $lc_key exists\n";
|
||||
next;
|
||||
}
|
||||
|
||||
$rec = $DB->new_record($lc_key);
|
||||
$rec->merge_props($host->props);
|
||||
|
||||
$host->delete;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user