2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-22 07:38:08 +00:00
Files
xcat-core/xCAT-test/native/fixtures/ubuntu_image/genimage.pl
T
Vinícius Ferrão a4e14299ee test(ubuntu): exercise genimage mirror selection
Read site settings from an isolated database and inspect the sources.list written into the image. Stop at an injected package-metadata failure without downloading packages.
2026-10-12 13:58:45 -03:00

21 lines
768 B
Perl

use strict;
use warnings;
use File::Slurper qw(read_text write_binary);
use JSON::PP qw(decode_json encode_json);
use xCAT::Table;
my %values = (master => '192.0.2.1', httpport => '80',
%{ decode_json(read_text('/work/site.json')) });
my $site = xCAT::Table->new('site', -create => 1);
for my $key (keys %values) {
$site->setAttribs({ key => $key }, { value => 'https://previous.example.invalid/ubuntu' })
if $key eq 'ubuntu_apt_mirror' && $values{$key} eq '';
$site->setAttribs({ key => $key }, { value => $values{$key} });
}
my $mirror_row = $site->getAttribs({ key => 'ubuntu_apt_mirror' }, qw(key value));
write_binary('/work/site-row.json', encode_json({ mirror => $mirror_row }));
$site->close();
exec 'perl', @ARGV;
die "exec genimage: $!";