summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Sinha <gaurav.sinha@vyatta.com>2011-11-09 16:38:23 -0800
committerGaurav Sinha <gaurav.sinha@vyatta.com>2011-11-09 16:38:23 -0800
commit68cd41c6547d6e511d55c0046bc88c1598cecf54 (patch)
tree7140cf820a53dff192cb85570252a0b8ecd19e27
parente81cb347e56e9b3cec8faa119aacbc0ef7ce9cef (diff)
parentf6c2586a9d552abc977a5c7a148fd21b070d04a8 (diff)
downloadvyatta-op-68cd41c6547d6e511d55c0046bc88c1598cecf54.tar.gz
vyatta-op-68cd41c6547d6e511d55c0046bc88c1598cecf54.zip
Merge branch 'oxnard' of git.vyatta.com:/git/vyatta-op into oxnard
-rw-r--r--debian/changelog7
-rw-r--r--scripts/dhcpv6-client-show-leases.pl10
-rw-r--r--scripts/rename-image.pl21
3 files changed, 22 insertions, 16 deletions
diff --git a/debian/changelog b/debian/changelog
index 2f4ecd5..a5ab91d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vyatta-op (0.13.213) unstable; urgency=low
+
+ * Fix perlcritic warning about bareword file handle
+ * cleanup rename-image
+
+ -- Stephen Hemminger <shemminger@vyatta.com> Wed, 09 Nov 2011 08:19:04 -0800
+
vyatta-op (0.13.212) unstable; urgency=low
* Remove accidental commit of 'show system boot-messages commit'
diff --git a/scripts/dhcpv6-client-show-leases.pl b/scripts/dhcpv6-client-show-leases.pl
index 546668c..44be689 100644
--- a/scripts/dhcpv6-client-show-leases.pl
+++ b/scripts/dhcpv6-client-show-leases.pl
@@ -74,13 +74,11 @@ my %ghash = ();
foreach my $lease_filename (@lease_files) {
my @lines=();
- if (!open(LEASE_FILE, "</var/lib/dhcp3/$lease_filename")) {
- printf("Can't open lease file for reading: $lease_filename\n");
- exit 1;
- }
+ open(my $f, '<', "/var/lib/dhcp3/$lease_filename")
+ or die "Can't open lease file for reading: $lease_filename\n";
- @lines = <LEASE_FILE>;
- close(LEASE_FILE);
+ @lines = <$f>;
+ close $f;
chomp @lines;
my $level = 0;
diff --git a/scripts/rename-image.pl b/scripts/rename-image.pl
index 8632334..be30967 100644
--- a/scripts/rename-image.pl
+++ b/scripts/rename-image.pl
@@ -24,6 +24,8 @@ use strict;
use warnings;
use Getopt::Long;
use File::Temp qw/ tempfile tempdir /;
+use File::Copy;
+use Sys::Syslog qw/:standard :macros/;
my $UNION_BOOT = '/live/image/boot';
my $XEN_DEFAULT_IMAGE = "$UNION_BOOT/%%default_image";
@@ -99,16 +101,14 @@ my $tmpfh;
my $tmpfilename;
($tmpfh, $tmpfilename) = tempfile();
-if (!open (GRUBFH, "<${image_path}/grub/grub.cfg")) {
- printf("Can't open grub file.\n");
- exit 1;
-}
+open (my $grubfh, '<', "${image_path}/grub/grub.cfg")
+ or die "Can't open grub file.\n";
# This is sensitive to the format of menu entries and boot paths
# in the grub config file.
#
my $line;
-while ($line = <GRUBFH>) {
+while ($line = <$grubfh>) {
$line =~ s/\/boot\/$old_name/\/boot\/$new_name/g;
$line =~ s/Vyatta $old_name/Vyatta $new_name/;
$line =~ s/Vyatta image $old_name/Vyatta image $new_name/;
@@ -117,13 +117,14 @@ while ($line = <GRUBFH>) {
}
close($tmpfh);
-close(GRUBFH);
+close($grubfh);
-system("mv $image_path/$old_name $image_path/$new_name");
-system("cp $tmpfilename $image_path/grub/grub.cfg");
+mv("$image_path/$old_name", "$image_path/$new_name")
+ or die "rename $old_name to $new_name failed: $!\n";
+cp($tmpfilename, "$image_path/grub/grub.cfg")
+ or die "copy $tmpfilename to grub.cfg failed: $!\n";
-system("logger -p local3.warning -t 'SystemImage' 'System image $old_name has been renamed $new_name'");
+syslog("warning", "System image $old_name has been renamed $new_name");
printf("Done.\n");
-