summaryrefslogtreecommitdiffstats
path: root/os-plugins/OpenSLX/OSPlugin
diff options
context:
space:
mode:
authorOliver Tappe2008-02-17 16:55:22 +0100
committerOliver Tappe2008-02-17 16:55:22 +0100
commit60bee60e6acbe08dfce92a9160a77860c00856ab (patch)
treeba037faaa8632690a5931edca1f8cc583194af3a /os-plugins/OpenSLX/OSPlugin
parent* correct implementation bug that caused last schema change to work only half... (diff)
downloadcore-60bee60e6acbe08dfce92a9160a77860c00856ab.tar.gz
core-60bee60e6acbe08dfce92a9160a77860c00856ab.tar.xz
core-60bee60e6acbe08dfce92a9160a77860c00856ab.zip
* added support to listing the plugins that have been installed into a
specific vendor-OS * several small fixes and improvements git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1558 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/OpenSLX/OSPlugin')
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm142
1 files changed, 83 insertions, 59 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index b96673fb..fe9efd8f 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -42,20 +42,22 @@ sub initialize
my $pluginName = shift;
my $vendorOSName = shift;
- $self->{'plugin-name'} = $pluginName;
- $self->{'vendor-os-name'} = $vendorOSName;
+ $self->{'vendor-os-name'} = $vendorOSName;
$self->{'vendor-os-path'}
= "$openslxConfig{'private-path'}/stage1/$vendorOSName";
vlog(1, "vendor-OS path is '$self->{'vendor-os-path'}'");
- $self->{'plugin-path'}
- = "$openslxConfig{'base-path'}/lib/plugins/$pluginName";
- vlog(1, "plugin path is '$self->{'plugin-path'}'");
-
- $self->{'plugin'} = $self->_loadPlugin();
- return if !$self->{'plugin'};
+ if ($pluginName) {
+ $self->{'plugin-name'} = $pluginName;
+ $self->{'plugin-path'}
+ = "$openslxConfig{'base-path'}/lib/plugins/$pluginName";
+ vlog(1, "plugin path is '$self->{'plugin-path'}'");
+ $self->{'plugin'} = $self->_loadPlugin();
+ return if !$self->{'plugin'};
+ }
+
return 1;
}
@@ -63,34 +65,35 @@ sub installPlugin
{
my $self = shift;
- # create ossetup-engine for given vendor-OS:
- my $osSetupEngine = OpenSLX::OSSetup::Engine->new;
- $osSetupEngine->initialize($self->{'vendor-os-name'}, 'plugin');
- $self->{'os-setup-engine'} = $osSetupEngine;
- $self->{'distro-name'} = $osSetupEngine->{'distro-name'};
-
- my $chrootedPluginRepoPath
- = "$openslxConfig{'base-path'}/plugin-repo/$self->{'plugin-name'}";
- my $pluginRepoPath = "$self->{'vendor-os-path'}/$chrootedPluginRepoPath";
- my $chrootedPluginTempPath = "/tmp/slx-plugin/$self->{'plugin-name'}";
- my $pluginTempPath = "$self->{'vendor-os-path'}/$chrootedPluginTempPath";
- foreach my $path ($pluginRepoPath, $pluginTempPath) {
- if (slxsystem("mkdir -p $path")) {
- croak(_tr("unable to create path '%s'! (%s)", $path, $!));
+ if ($self->{'vendor-os-name'} ne '<<<default>>>') {
+ # create ossetup-engine for given vendor-OS:
+ my $osSetupEngine = OpenSLX::OSSetup::Engine->new;
+ $osSetupEngine->initialize($self->{'vendor-os-name'}, 'plugin');
+ $self->{'os-setup-engine'} = $osSetupEngine;
+
+ my $chrootedPluginRepoPath
+ = "$openslxConfig{'base-path'}/plugin-repo/$self->{'plugin-name'}";
+ my $pluginRepoPath = "$self->{'vendor-os-path'}/$chrootedPluginRepoPath";
+ my $chrootedPluginTempPath = "/tmp/slx-plugin/$self->{'plugin-name'}";
+ my $pluginTempPath = "$self->{'vendor-os-path'}/$chrootedPluginTempPath";
+ foreach my $path ($pluginRepoPath, $pluginTempPath) {
+ if (slxsystem("mkdir -p $path")) {
+ croak(_tr("unable to create path '%s'! (%s)", $path, $!));
+ }
}
- }
-
- $self->{plugin}->preInstallationPhase($pluginRepoPath, $pluginTempPath);
- $self->{'os-setup-engine'}->callChrootedFunctionForVendorOS(
- sub {
- $self->{plugin}->installationPhase(
- $chrootedPluginRepoPath, $chrootedPluginTempPath
- );
- }
- );
-
- $self->{plugin}->postInstallationPhase($pluginRepoPath, $pluginTempPath);
+ $self->{plugin}->preInstallationPhase($pluginRepoPath, $pluginTempPath);
+
+ $self->{'os-setup-engine'}->callChrootedFunctionForVendorOS(
+ sub {
+ $self->{plugin}->installationPhase(
+ $chrootedPluginRepoPath, $chrootedPluginTempPath
+ );
+ }
+ );
+
+ $self->{plugin}->postInstallationPhase($pluginRepoPath, $pluginTempPath);
+ }
$self->_addInstalledPluginToDB();
@@ -108,40 +111,61 @@ sub removePlugin
{
my $self = shift;
- # create ossetup-engine for given vendor-OS:
- my $osSetupEngine = OpenSLX::OSSetup::Engine->new;
- $osSetupEngine->initialize($self->{'vendor-os-name'}, 'plugin');
- $self->{'os-setup-engine'} = $osSetupEngine;
- $self->{'distro-name'} = $osSetupEngine->{'distro-name'};
-
- my $chrootedPluginRepoPath
- = "$openslxConfig{'base-path'}/plugin-repo/$self->{'plugin-name'}";
- my $pluginRepoPath = "$self->{'vendor-os-path'}/$chrootedPluginRepoPath";
- my $chrootedPluginTempPath = "/tmp/slx-plugin/$self->{'plugin-name'}";
- my $pluginTempPath = "$self->{'vendor-os-path'}/$chrootedPluginTempPath";
- foreach my $path ($pluginRepoPath, $pluginTempPath) {
- if (slxsystem("mkdir -p $path")) {
- croak(_tr("unable to create path '%s'! (%s)", $path, $!));
- }
- }
-
- $self->{plugin}->preRemovalPhase($pluginRepoPath, $pluginTempPath);
+ if ($self->{'vendor-os-name'} ne '<<<default>>>') {
+ # create ossetup-engine for given vendor-OS:
+ my $osSetupEngine = OpenSLX::OSSetup::Engine->new;
+ $osSetupEngine->initialize($self->{'vendor-os-name'}, 'plugin');
+ $self->{'os-setup-engine'} = $osSetupEngine;
- $self->{'os-setup-engine'}->callChrootedFunctionForVendorOS(
- sub {
- $self->{plugin}->removalPhase(
- $chrootedPluginRepoPath, $chrootedPluginTempPath
- );
+ my $chrootedPluginRepoPath
+ = "$openslxConfig{'base-path'}/plugin-repo/$self->{'plugin-name'}";
+ my $pluginRepoPath = "$self->{'vendor-os-path'}/$chrootedPluginRepoPath";
+ my $chrootedPluginTempPath = "/tmp/slx-plugin/$self->{'plugin-name'}";
+ my $pluginTempPath = "$self->{'vendor-os-path'}/$chrootedPluginTempPath";
+ foreach my $path ($pluginRepoPath, $pluginTempPath) {
+ if (slxsystem("mkdir -p $path")) {
+ croak(_tr("unable to create path '%s'! (%s)", $path, $!));
+ }
}
- );
- $self->{plugin}->postRemovalPhase($pluginRepoPath, $pluginTempPath);
+ $self->{plugin}->preRemovalPhase($pluginRepoPath, $pluginTempPath);
+
+ $self->{'os-setup-engine'}->callChrootedFunctionForVendorOS(
+ sub {
+ $self->{plugin}->removalPhase(
+ $chrootedPluginRepoPath, $chrootedPluginTempPath
+ );
+ }
+ );
+
+ $self->{plugin}->postRemovalPhase($pluginRepoPath, $pluginTempPath);
+ }
$self->_removeInstalledPluginFromDB();
return 1;
}
+sub getInstalledPlugins
+{
+ my $self = shift;
+
+ my $openslxDB = instantiateClass("OpenSLX::ConfigDB");
+ $openslxDB->connect();
+ my $vendorOS = $openslxDB->fetchVendorOSByFilter( {
+ name => $self->{'vendor-os-name'},
+ } );
+ if (!$vendorOS) {
+ die _tr(
+ 'unable to find vendor-OS "%s" in DB!', $self->{'vendor-os-name'}
+ );
+ }
+ my @installedPlugins = $openslxDB->fetchInstalledPlugins($vendorOS->{id});
+ $openslxDB->disconnect();
+
+ return @installedPlugins;
+}
+
sub _loadPlugin
{
my $self = shift;