initial commit of file from CVS for e-smith-hosts on Wed 12 Jul 08:56:08 BST 2023
This commit is contained in:
20
root/etc/e-smith/db/hosts/migrate/20eachdomain
Normal file
20
root/etc/e-smith/db/hosts/migrate/20eachdomain
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
use esmith::DomainsDB;
|
||||
my $ddb = esmith::DomainsDB->open_ro;
|
||||
# If there's no domains db, there's nothing to do
|
||||
return unless $ddb;
|
||||
|
||||
# For any bare hostname, create a qualified host record
|
||||
# for each domain, then delete the bare host record
|
||||
foreach my $host (grep { $_->key !~ /\./ } $DB->get_all)
|
||||
{
|
||||
my $key = $host->key;
|
||||
foreach my $d ($ddb->domains)
|
||||
{
|
||||
$d = $d->key;
|
||||
next if $DB->get("$key.$d");
|
||||
$DB->new_record("$key.$d", { $host->props });
|
||||
}
|
||||
$host->delete;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user