summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSebastian Schmelzer2009-06-04 15:26:19 +0200
committerSebastian Schmelzer2009-06-04 15:26:19 +0200
commit7205391ff143f201ccc699c7348402a5e6d279f7 (patch)
tree2737f2d7dbb6c8bdd70f79938cb155cf74ddd0fe /lib
parent* removed debug-output (diff)
downloadcore-7205391ff143f201ccc699c7348402a5e6d279f7.tar.gz
core-7205391ff143f201ccc699c7348402a5e6d279f7.tar.xz
core-7205391ff143f201ccc699c7348402a5e6d279f7.zip
fix "Module not found" bug of distroutils in plugin install routine
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2932 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib')
-rw-r--r--lib/OpenSLX/DistroUtils/Engine.pm27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/OpenSLX/DistroUtils/Engine.pm b/lib/OpenSLX/DistroUtils/Engine.pm
index 354210e3..2a369ca2 100644
--- a/lib/OpenSLX/DistroUtils/Engine.pm
+++ b/lib/OpenSLX/DistroUtils/Engine.pm
@@ -29,17 +29,38 @@ sub new
sub loadDistro {
my $self = shift;
my $distroName = shift;
+ $distroName = ucfirst($distroName);
my $distro;
+
+ my $pathToClass = "$openslxConfig{'base-path'}/lib";
+ my $flags = {};
+ if ($pathToClass) {
+ $flags->{incPaths} = [ $pathToClass ];
+ # if you call this function inside a plugin's install method we have to add /mnt
+ # in front of the include path!
+ $flags->{incPaths} = [ "/mnt/$pathToClass" ];
+ }
+
my $loaded = eval {
- $distro = instantiateClass("OpenSLX::DistroUtils::${distroName}");
+ $distro = instantiateClass("OpenSLX::DistroUtils::${distroName}", $flags);
+ return 0 if !$distro; # module does not exist, try next
+ 1;
+ };
+
+ if (!$loaded) {
+ vlog(1, "can't find distro specific class, try base class..");
+ $loaded = eval {
+ $distro = instantiateClass("OpenSLX::DistroUtils::Base", $flags);
return 0 if !$distro; # module does not exist, try next
1;
};
+ }
+
if (!$loaded) {
- $distro = instantiateClass("OpenSLX::DistroUtils::Base");
- print ('couldnt load distro class');
+ vlog(1, "failed to load DistroUtils!");
}
+
return $distro;
}