From 15ff4aff86f0ac340552c5452dcde0a155273403 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Tue, 10 Mar 2020 12:52:09 +0100 Subject: [PATCH] added error handling --- mirror-nixos-branch.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mirror-nixos-branch.pl b/mirror-nixos-branch.pl index 74b4df1..9fb5e05 100755 --- a/mirror-nixos-branch.pl +++ b/mirror-nixos-branch.pl @@ -225,8 +225,8 @@ system("git push origin $rev:refs/heads/$channelName >&2") == 0 or die; system("git push channels $rev:refs/heads/$channelName >&2") == 0 or die; # Update channel on channels.nixos.org -$bucketChannels->add_key($channelName, $target, { "x-amz-website-redirect-location" => $target }); -$bucketChannels->add_key("$channelName/nixexprs.tar.xz", $target, { "x-amz-website-redirect-location" => "$target/nixexprs.tar.xz" }); +$bucketChannels->add_key($channelName, $target, { "x-amz-website-redirect-location" => $target }) or die $bucketChannels->err . ": " . $bucketChannels->errstr; +$bucketChannels->add_key("$channelName/nixexprs.tar.xz", $target, { "x-amz-website-redirect-location" => "$target/nixexprs.tar.xz" }) or die $bucketChannels->err . ": " . $bucketChannels->errstr; # for nixos channels also create redirects for latest images if ($channelName =~ /nixos/) { @@ -237,8 +237,8 @@ if ($channelName =~ /nixos/) { ) { for my $arch ("x86_64", "i686") { for my $format ("ova", "iso") { - $bucketChannels->add_key("$channelName/latest-$artifact-$arch-linux.$format", "", {"x-amz-website-redirect-location" => "$target/$artifact-$releaseThingy-$arch-linux.$format" }); - $bucketChannels->add_key("$channelName/latest-$artifact-$arch-linux.$format.sha256", "", {"x-amz-website-redirect-location" => "$target/$artifact-$releaseThingy-$arch-linux.$format.sha256" }); + $bucketChannels->add_key("$channelName/latest-$artifact-$arch-linux.$format", "", {"x-amz-website-redirect-location" => "$target/$artifact-$releaseThingy-$arch-linux.$format" }) or die $bucketChannels->err . ": " . $bucketChannels->errstr; + $bucketChannels->add_key("$channelName/latest-$artifact-$arch-linux.$format.sha256", "", {"x-amz-website-redirect-location" => "$target/$artifact-$releaseThingy-$arch-linux.$format.sha256" }) or die $bucketChannels->err . ": " . $bucketChannels->errstr; } } }