summaryrefslogtreecommitdiffstats
path: root/installer/OpenSLX/OSExport
diff options
context:
space:
mode:
Diffstat (limited to 'installer/OpenSLX/OSExport')
-rw-r--r--installer/OpenSLX/OSExport/BlockDevice/AoE.pm15
-rw-r--r--installer/OpenSLX/OSExport/BlockDevice/Base.pm10
-rw-r--r--installer/OpenSLX/OSExport/BlockDevice/NBD.pm14
-rw-r--r--installer/OpenSLX/OSExport/Distro/Any.pm8
-rw-r--r--installer/OpenSLX/OSExport/Distro/Base.pm11
-rw-r--r--installer/OpenSLX/OSExport/Distro/Debian.pm8
-rw-r--r--installer/OpenSLX/OSExport/Distro/Fedora.pm8
-rw-r--r--installer/OpenSLX/OSExport/Distro/Gentoo.pm8
-rw-r--r--installer/OpenSLX/OSExport/Distro/SUSE.pm8
-rw-r--r--installer/OpenSLX/OSExport/Distro/Ubuntu.pm8
-rw-r--r--installer/OpenSLX/OSExport/Engine.pm13
-rw-r--r--installer/OpenSLX/OSExport/FileSystem/Base.pm10
-rw-r--r--installer/OpenSLX/OSExport/FileSystem/NFS.pm35
-rw-r--r--installer/OpenSLX/OSExport/FileSystem/SquashFS.pm27
14 files changed, 79 insertions, 104 deletions
diff --git a/installer/OpenSLX/OSExport/BlockDevice/AoE.pm b/installer/OpenSLX/OSExport/BlockDevice/AoE.pm
index c8aad4ec..2113ef5c 100644
--- a/installer/OpenSLX/OSExport/BlockDevice/AoE.pm
+++ b/installer/OpenSLX/OSExport/BlockDevice/AoE.pm
@@ -14,12 +14,11 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::BlockDevice::AoE;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::BlockDevice::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use File::Basename;
use OpenSLX::Basics;
use OpenSLX::ConfigDB qw(:support);
@@ -32,7 +31,6 @@ use OpenSLX::Utils;
#
#
-
################################################################################
### interface methods
################################################################################
@@ -66,10 +64,9 @@ sub generateExportURI
my $self = shift;
my $export = shift;
- my $server =
- length($export->{server_ip})
- ? $export->{server_ip}
- : generatePlaceholderFor('serverip');
+ my $serverIP = $export->{server_ip} || '';
+ my $server
+ = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip');
$server .= ":$export->{port}" if length($export->{port});
return "aoe://$server";
diff --git a/installer/OpenSLX/OSExport/BlockDevice/Base.pm b/installer/OpenSLX/OSExport/BlockDevice/Base.pm
index 938dc6db..ef59f86b 100644
--- a/installer/OpenSLX/OSExport/BlockDevice/Base.pm
+++ b/installer/OpenSLX/OSExport/BlockDevice/Base.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::BlockDevice::Base;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
-
use strict;
-use Carp;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
-use OpenSLX::Basics;
-use OpenSLX::Utils;
+use Carp qw(confess);
################################################################################
### interface methods
diff --git a/installer/OpenSLX/OSExport/BlockDevice/NBD.pm b/installer/OpenSLX/OSExport/BlockDevice/NBD.pm
index 8afaa97f..89f10b66 100644
--- a/installer/OpenSLX/OSExport/BlockDevice/NBD.pm
+++ b/installer/OpenSLX/OSExport/BlockDevice/NBD.pm
@@ -14,12 +14,11 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::BlockDevice::NBD;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::BlockDevice::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use File::Basename;
use OpenSLX::Basics;
use OpenSLX::ConfigDB qw(:support);
@@ -59,10 +58,9 @@ sub generateExportURI
my $self = shift;
my $export = shift;
- my $server =
- length($export->{server_ip})
- ? $export->{server_ip}
- : generatePlaceholderFor('serverip');
+ my $serverIP = $export->{server_ip} || '';
+ my $server
+ = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip');
$server .= ":$export->{port}" if length($export->{port});
return "nbd://$server";
diff --git a/installer/OpenSLX/OSExport/Distro/Any.pm b/installer/OpenSLX/OSExport/Distro/Any.pm
index 828e4990..976bbadf 100644
--- a/installer/OpenSLX/OSExport/Distro/Any.pm
+++ b/installer/OpenSLX/OSExport/Distro/Any.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::Any;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::Distro::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use OpenSLX::Basics;
-use OpenSLX::OSExport::Distro::Base 1;
################################################################################
### implementation
diff --git a/installer/OpenSLX/OSExport/Distro/Base.pm b/installer/OpenSLX/OSExport/Distro/Base.pm
index 645523c6..f1986ee5 100644
--- a/installer/OpenSLX/OSExport/Distro/Base.pm
+++ b/installer/OpenSLX/OSExport/Distro/Base.pm
@@ -14,13 +14,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::Base;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
-
use strict;
-use Carp;
-use File::Basename;
-use OpenSLX::Basics;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Carp qw(confess);
################################################################################
### interface methods
diff --git a/installer/OpenSLX/OSExport/Distro/Debian.pm b/installer/OpenSLX/OSExport/Distro/Debian.pm
index 35e7f4c9..5f161902 100644
--- a/installer/OpenSLX/OSExport/Distro/Debian.pm
+++ b/installer/OpenSLX/OSExport/Distro/Debian.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::Debian;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::Distro::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use OpenSLX::Basics;
-use OpenSLX::OSExport::Distro::Base 1;
################################################################################
### implementation
diff --git a/installer/OpenSLX/OSExport/Distro/Fedora.pm b/installer/OpenSLX/OSExport/Distro/Fedora.pm
index 9374678d..0ef3e028 100644
--- a/installer/OpenSLX/OSExport/Distro/Fedora.pm
+++ b/installer/OpenSLX/OSExport/Distro/Fedora.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::Fedora;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::Distro::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use OpenSLX::Basics;
-use OpenSLX::OSExport::Distro::Base 1;
################################################################################
### implementation
diff --git a/installer/OpenSLX/OSExport/Distro/Gentoo.pm b/installer/OpenSLX/OSExport/Distro/Gentoo.pm
index c7d4575f..4d908650 100644
--- a/installer/OpenSLX/OSExport/Distro/Gentoo.pm
+++ b/installer/OpenSLX/OSExport/Distro/Gentoo.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::Gentoo;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::Distro::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use OpenSLX::Basics;
-use OpenSLX::OSExport::Distro::Base 1;
################################################################################
### implementation
diff --git a/installer/OpenSLX/OSExport/Distro/SUSE.pm b/installer/OpenSLX/OSExport/Distro/SUSE.pm
index 7da7656b..1f826159 100644
--- a/installer/OpenSLX/OSExport/Distro/SUSE.pm
+++ b/installer/OpenSLX/OSExport/Distro/SUSE.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::SUSE;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::Distro::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use OpenSLX::Basics;
-use OpenSLX::OSExport::Distro::Base 1;
################################################################################
### implementation
diff --git a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm
index 409bb0cf..8dbaae9e 100644
--- a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm
+++ b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Distro::Ubuntu;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::Distro::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use OpenSLX::Basics;
-use OpenSLX::OSExport::Distro::Base 1;
################################################################################
### implementation
diff --git a/installer/OpenSLX/OSExport/Engine.pm b/installer/OpenSLX/OSExport/Engine.pm
index 5d08c177..31a71b5a 100644
--- a/installer/OpenSLX/OSExport/Engine.pm
+++ b/installer/OpenSLX/OSExport/Engine.pm
@@ -13,7 +13,10 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::Engine;
-use vars qw(@ISA @EXPORT $VERSION);
+use strict;
+use warnings;
+
+our (@ISA, @EXPORT, $VERSION);
$VERSION = 1.01; # API-version . implementation-version
use Exporter;
@@ -24,16 +27,14 @@ use Exporter;
@supportedExportTypes %supportedDistros
);
-use strict;
-use Carp;
use File::Basename;
use OpenSLX::Basics;
use OpenSLX::Utils;
-use vars qw(
- %supportedExportFileSystems %supportedExportBlockDevices
- @supportedExportTypes %supportedDistros
+our (
+ %supportedExportFileSystems, %supportedExportBlockDevices,
+ @supportedExportTypes, %supportedDistros
);
%supportedExportFileSystems = (
diff --git a/installer/OpenSLX/OSExport/FileSystem/Base.pm b/installer/OpenSLX/OSExport/FileSystem/Base.pm
index bb6f42d3..0822c458 100644
--- a/installer/OpenSLX/OSExport/FileSystem/Base.pm
+++ b/installer/OpenSLX/OSExport/FileSystem/Base.pm
@@ -13,14 +13,12 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::FileSystem::Base;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
-
use strict;
-use Carp;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
-use OpenSLX::Basics;
-use OpenSLX::Utils;
+use Carp qw(confess);
################################################################################
### interface methods
diff --git a/installer/OpenSLX/OSExport/FileSystem/NFS.pm b/installer/OpenSLX/OSExport/FileSystem/NFS.pm
index ffeaeffd..0073d55c 100644
--- a/installer/OpenSLX/OSExport/FileSystem/NFS.pm
+++ b/installer/OpenSLX/OSExport/FileSystem/NFS.pm
@@ -13,17 +13,15 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::FileSystem::NFS;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::FileSystem::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use File::Basename;
use OpenSLX::Basics;
use OpenSLX::ConfigDB qw(:support);
use OpenSLX::Utils;
-use OpenSLX::OSExport::FileSystem::Base 1;
################################################################################
### interface methods
@@ -74,11 +72,11 @@ sub generateExportURI
my $export = shift;
my $vendorOS = shift;
- my $server
- = length($export->{server_ip})
- ? $export->{server_ip}
- : generatePlaceholderFor('serverip');
- $server .= ":$export->{port}" if length($export->{port});
+ my $serverIP = $export->{server_ip} || '';
+ my $server
+ = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip');
+ my $port = $export->{port} || '';
+ $server .= ":$port" if length($port);
my $exportPath = "$openslxConfig{'public-path'}/export";
return "nfs://$server$exportPath/nfs/$vendorOS->{name}";
@@ -98,7 +96,7 @@ sub showExportConfigInfo
print (('#' x 80)."\n");
print _tr("Please make sure the following line is contained in /etc/exports\nin order to activate the NFS-export of this vendor-OS:\n\t%s\n",
- "$self->{engine}->{'export-path'}\t*(ro,no_root_squash,async,no_subtree_check)");
+ "$self->{'export-path'}\t*(ro,no_root_squash,async,no_subtree_check)");
print (('#' x 80)."\n");
# TODO : add something a bit more clever here...
@@ -120,14 +118,14 @@ sub _copyViaRsync
}
my $includeExcludeList = $self->_determineIncludeExcludeList();
vlog(1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList));
- open(RSYNC, "| rsync -av --delete --exclude-from=- $source/ $target")
+ my $rsyncFH;
+ open($rsyncFH, '|-', "rsync -av --delete --exclude-from=- $source/ $target")
or die _tr("unable to start rsync for source '%s', giving up! (%s)",
$source, $!);
- print RSYNC $includeExcludeList;
- if (!close(RSYNC)) {
- die _tr("unable to export to target '%s', giving up! (%s)",
- $target, $!);
- }
+ print $rsyncFH $includeExcludeList;
+ close($rsyncFH)
+ or die _tr("unable to export to target '%s', giving up! (%s)",
+ $target, $!);
}
sub _determineIncludeExcludeList
@@ -140,7 +138,8 @@ sub _determineIncludeExcludeList
my $distroName = $self->{engine}->{'distro-name'};
my $localFilterFile
= "$openslxConfig{'config-path'}/distro-info/$distroName/export-filter";
- my $includeExcludeList = slurpFile($localFilterFile, 1);
+ my $includeExcludeList
+ = slurpFile($localFilterFile, { failIfMissing => 0 });
$includeExcludeList .= $self->{engine}->{distro}->{'export-filter'};
$includeExcludeList =~ s[^\s+][]igms;
# remove any leading whitespace, as rsync doesn't like it
diff --git a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm
index 48efb45b..6aeb9cd2 100644
--- a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm
+++ b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm
@@ -14,12 +14,11 @@
# -----------------------------------------------------------------------------
package OpenSLX::OSExport::FileSystem::SquashFS;
-use vars qw($VERSION);
+use strict;
+use warnings;
+
use base qw(OpenSLX::OSExport::FileSystem::Base);
-$VERSION = 1.01; # API-version . implementation-version
-use strict;
-use Carp;
use File::Basename;
use OpenSLX::Basics;
use OpenSLX::ConfigDB qw(:support);
@@ -61,11 +60,11 @@ sub exportVendorOS
vlog(1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList));
my $target = $self->{'export-path'};
- my $sourceTime = (stat($source))[9];
- my $targetTime = (stat($target))[9];
+ my $sourceTime = (stat($source))[9] || 0;
+ my $targetTime = (stat($target))[9] || 0;
vlog(2, "source-time=$sourceTime target-time=$targetTime");
- if (defined $targetTime && $sourceTime < $targetTime) {
+ if ($targetTime && $sourceTime < $targetTime) {
vlog(
0,
"!!! creation of squashfs skipped, as vendor-OS hasn't changed since last export!\n"
@@ -115,7 +114,7 @@ sub checkRequirements
"unable to find blockdevice-module '%s' for kernel version '%s'.",
$blockModName, $kernelVer
);
- return undef;
+ return;
}
push @blockMods, $blockMod;
}
@@ -130,7 +129,7 @@ sub checkRequirements
if (!defined $squashfsMod) {
warn _tr("unable to find squashfs-module for kernel version '%s'.",
$kernelVer);
- return undef;
+ return;
}
push @blockMods, $squashfsMod;
if (defined $info) {
@@ -205,10 +204,7 @@ sub _createSquashFS
# dump filter to a file ...
my $filterFile = "/tmp/slx-nbdsquash-filter-$$";
- open(FILTERFILE, "> $filterFile")
- or die _tr("unable to create tmpfile '%s' (%s)", $filterFile, $!);
- print FILTERFILE $includeExcludeList;
- close(FILTERFILE);
+ spitFile($filterFile, $includeExcludeList);
# ... invoke mksquashfs ...
vlog(0, _tr("invoking mksquashfs..."));
@@ -234,7 +230,8 @@ sub _determineIncludeExcludeList
my $distroName = $self->{engine}->{'distro-name'};
my $localFilterFile =
"$openslxConfig{'config-path'}/distro-info/$distroName/export-filter";
- my $includeExcludeList = slurpFile($localFilterFile, 1);
+ my $includeExcludeList
+ = slurpFile($localFilterFile, { failIfMissing => 0 });
$includeExcludeList .= $self->{engine}->{distro}->{'export-filter'};
$includeExcludeList =~ s[^\s+][]igms;
# remove any leading whitespace, as rsync doesn't like it
@@ -310,7 +307,7 @@ sub _locateKernelModule
if (defined $location) {
return followLink($location, $vendorOSPath);
}
- return undef;
+ return;
}
sub _addBlockDeviceTagToExport