App-LXC-Container
view release on metacpan or search on metacpan
lib/App/LXC/Container/Update.pm view on Meta::CPAN
my @paths = ($_);
unshift @paths, $_ while s|/+(?:[^/]+)$|| and $_;
my $root = $self->{root_fs} . '/' . $self->{name};
-d $root or mkdir $root or fatal('can_t_create__1__2', $root, $!);
foreach (@paths)
{
-e $_ or fatal('_1_does_not_exist', $path);
my $target = $root . $_;
next if -e $target;
my $stat = stat($_);
my ($mode, $uid, $gid) = ($stat->mode, $stat->uid, $stat->gid);
if (-d)
{
$mode |= 0200; # prevent blocking ourselves later on
if (-l)
{
# links can be arbitrarily deep, so we use make_path on the
# absolute path and hope for no clashes:
$target = $root . abs_path($_);
my $errors = [];
t/06-update.t view on Meta::CPAN
}
ok(! -e CONF_ROOT . '/update-test-1/usr/lib/some/directory/with/file-1.txt',
'no file-1.txt in /update-test-1/usr/lib/some/directory/with');
foreach my $bin (qw(1chromium 2something 3link))
{
$_ = $tmp_sub . '/usr/bin/' . $bin;
ok(-f CONF_ROOT . '/update-test-1/' . $_, 'got file: /' . $_);
}
$_ = $tmp_sub . '/usr/bin/3link';
ok(-l CONF_ROOT . '/update-test-1/' . $_, 'got link: /' . $_);
is((stat(CONF_ROOT . '/update-test-1/root'))[2] & 07777, 0700,
'/root has correct permission');
is((stat(CONF_ROOT . '/update-test-1/tmp'))[2] & 07777, 01777,
'/tmp has correct permission');
#####################################################################
# tests of local-network and network container:
foreach my $network ('local-network', 'network')
{
output_like # last name becomes container name!
{ App::LXC::Container::update($network); }
qr{^$},
qr{\A$re_err2$re_err3\Z},
t/06-update.t view on Meta::CPAN
ok(-l $conf_dir . $_, 'got link /' . $_ . ' in ' . $network);
}
}
foreach (qw(root tmp var var/log),
map { $tmp_sub . '/' . $_ } qw(usr usr/bin))
{
ok(-d $conf_dir . $_, 'got directory /' . $_ . ' in ' . $network);
}
$_ = $tmp_sub . '/usr/bin/2something';
ok(-f $conf_dir . $_, 'got file /' . $_ . ' in ' . $network);
is((stat(CONF_ROOT . '/' . $network . '/root'))[2] & 07777, 0700,
'/root has correct permission in ' . $network);
is((stat(CONF_ROOT . '/' . $network . '/tmp'))[2] & 07777, 01777,
'/tmp has correct permission in ' . $network);
}
} # end of big SKIP block
( run in 1.183 second using v1.01-cache-2.11-cpan-49f99fa48dc )