summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Tappe2008-02-23 19:44:04 +0100
committerOliver Tappe2008-02-23 19:44:04 +0100
commit494241071bd94d5e4b87ba113753642e57090af8 (patch)
tree3da20fea677f6be344826c3b599528022e8ad590
parent* Instead of giving up when a plugin folder does not contain the corresponding (diff)
downloadcore-494241071bd94d5e4b87ba113753642e57090af8.tar.gz
core-494241071bd94d5e4b87ba113753642e57090af8.tar.xz
core-494241071bd94d5e4b87ba113753642e57090af8.zip
* adjusted plugin-API according to recent discussion with Volker:
+ dropped pre- and post-methods as they are not really needed, since ... + we now bind-mount /opt/openslx into /mnt/openslx of the vendor-OS chroot, so plugins can copy any required files from there * cleaned up existing plugin implementations * improved documentation for plugin developers (available via 'perldoc os-plugins/OpenSLX/OSPlugins/Base.pm'). git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1570 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Base.pm296
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm49
-rw-r--r--os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm100
-rw-r--r--os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm8
-rw-r--r--os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm43
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm36
6 files changed, 306 insertions, 226 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm
index c1945c95..2eef4b82 100644
--- a/os-plugins/OpenSLX/OSPlugin/Base.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Base.pm
@@ -18,48 +18,137 @@ use warnings;
our $VERSION = 1.01; # API-version . implementation-version
+=head1 NAME
+
+OpenSLX::OSPlugin::Base - the base class for all OpenSLX OS-plugins.
+
+=head1 DESCRIPTION
+
+This class defines the OpenSLX API for OS-plugins.
+
+The general idea behind OS-plugins is to extend any installed vendor-OS with
+a specific features. Each feature is implemented as a separate, small software
+component in order to make them easy to understand and maintain.
+
+Since all of these software components are plugged into the OpenSLX system by
+means of a common API, we call them B<OS-plugin>s.
+
+This API can be separated into different parts:
+
+=over
+
+=item - L</Declarative Interface> (provide info about a plugin)
+
+=item - L</Vendor-OS Interface> (installing or removing a plugin into/from a
+vendor-OS)
+
+=item - L</Initramfs Interface> (integrating a plugin into an initramfs)
+
+=item - L</Support Interface> (offers each plugin access to OpenSLX services)
+
+=back
+
+=head1 MORE INFO
+
+Please read the user-level introduction on plugins in the OpenSLX-wiki:
+L<http://openslx.org/trac/de/openslx/wiki/PluginKonzept> (in German).
+
+If you'd like to know how a plugin is implemented, please have a look at the
+'example' plugin, which contains some explainations and useful hints.
+
+If you have any questions regarding the concept of OS-plugins and their
+implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+'#openslx' (on freenode).
+
+=cut
+
use OpenSLX::Basics;
-################################################################################
-# if you have any questions regarding the concept of OS-plugins and their
-# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
-# '#openslx' (on freenode).
-################################################################################
+=head1 PLUGIN API
+
+=head2 Declarative Interface
+
+=over
+
+=item new()
+
+Every plugin should provide a new-method and provide it's own name in the
+'name' entry of $self.
+
+Please note that by convention, plugin names are all lowercase!
+
+=cut
sub new
{
confess "Creating OpenSLX::OSPlugin::Base-objects directly makes no sense!";
}
+=item initialize()
+
+Initializes basic context for this plugin (esp. a reference to the OSPlugin
+engine that drives this plugin.
+
+=cut
+
sub initialize
{
my $self = shift;
- # The os-plugin-engine drives us, it provides some useful services relevant
- # to installing stuff into the vendor-OS, like downloading functionality,
- # access to meta-packager, ...
$self->{'os-plugin-engine'} = shift;
return;
}
+=item getInfo()
+
+Returns a hash-ref with administrative information about this plugin (what does
+it do and how does it relate to other plugins). Every plugin needs to provide
+this method and return the information about itself.
+
+=cut
+
sub getInfo
-{ # returns a hash-ref with administrative information about this plugin
- # (what does it do and how does it relate to other plugins)
+{
my $self = shift;
return {
# a short (one-liner) description of this plugin
description => '',
- # a list of plugins that must have completed before this plugin can
- # be executed
- mustRunAfter => [],
};
}
+=item getAttrInfo()
+
+Returns a hash-ref with information about all attributes supported by this
+specific plugin.
+
+This default configuration will be added as attributes to the default system,
+such that it can be overruled for any specific system by means of B<slxconfig>.
+
+The returned hash-ref must include at least the following entries:
+
+=over
+
+=item B<I<plugin-name>::active>
+
+Indicates whether or not this plugin is active (1 for active, 0 for inactive).
+
+=item B<I<plugin-name>::precedence>
+
+Specifies the execution precedence of this plugin with respect to all other
+plugins (plugins with lower precedences will be started before the ones with
+a higher precedence).
+
+Valid values range from 0-99. If your plugin does not have any requirements
+in this context, just specify the default value '50'.
+
+=back
+
+=cut
+
sub getAttrInfo
-{ # returns a hash-ref with information about all attributes supported
- # by this specific plugin
+{
my $self = shift;
# This default configuration will be added as attributes to the default
@@ -71,107 +160,125 @@ sub getAttrInfo
};
}
-sub preInstallationPhase
-{ # called before chrooting into vendor-OS root, should be used if any files
- # have to be downloaded outside of the chroot (which might be necessary
- # if the required files can't be installed via the meta-packager)
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin should store all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
-
- return;
-}
+=back
+
+=head2 Vendor-OS Interface
+
+=over
+
+=item installationPhase()
+
+In this method, the plugin should install itself into the given vendor-OS.
+
+What "installation" means is up to the plugin. Some plugins may just copy
+a file from the OpenSLX host installation into the vendor-OS, while others may
+need to download files from the internet and/or install packages through the
+vendor-OS' meta packager.
+
+N.B.: This method is invoked while chrooted into the vendor-OS root. In order to
+make the OpenSLX files from the host available, the OpenSLX base folder
+(normally /opt/openslx) will be mounted to /mnt/openslx. So if you have to copy
+any files from the host, fetch them from there.
+
+=cut
sub installationPhase
-{ # called while chrooted to the vendor-OS root, most plugins will do all
- # their installation work here
+{
my $self = shift;
my $pluginRepositoryPath = shift;
- # the repository folder, this time from inside the chroot
+ # the repository folder, relative to the vendor-OS root
my $pluginTempPath = shift;
- # the temporary folder, this time from inside the chroot
+ # the temporary folder, relative to the vendor-OS root
+ my $openslxPath = shift;
+ # the openslx base path bind-mounted into the chroot (/mnt/openslx)
return;
}
-sub postInstallationPhase
-{ # called after having returned from chrooted environment, should be used
- # to cleanup any leftovers, if any such thing is necessary
- my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
- return;
-}
+=item removalPhase()
-sub preRemovalPhase
-{ # called before chrooting into vendor-OS root, should be used if any
- # preparations outside of the chroot have to be made before the plugin
- # can be removed
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin has stored all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
-
- return;
-}
+In this method, the plugin should remove itself from the given vendor-OS.
+
+What "removal" means is up to the plugin. Some plugins may just delete
+a file from the vendor-OS, while others may need to uninstall packages through
+the vendor-OS' meta packager.
+
+N.B.: This method is invoked while chrooted into the vendor-OS root.
+
+=cut
sub removalPhase
-{ # called while chrooted to the vendor-OS root, most plugins will do all
- # their uninstallation work here
+{
my $self = shift;
my $pluginRepositoryPath = shift;
- # the repository folder, this time from inside the chroot
+ # the repository folder, relative to the vendor-OS root
my $pluginTempPath = shift;
- # the temporary folder, this time from inside the chroot
+ # the temporary folder, relative to the vendor-OS root
+ my $openslxPath = shift;
+ # the openslx base path bind-mounted into the chroot (/mnt/openslx)
return;
}
-sub postRemovalPhase
-{ # called after having returned from chrooted environment, should be used
- # to cleanup any leftovers, if any such thing is necessary
- my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
- return;
-}
+=back
+
+=head2 Initramfs Interface
+
+All of the following methods are invoked by the config demuxer when it makes an
+initramfs for a system that has this plugin activated. Through these methods,
+each plugin can integrate itself into that initramfs.
+
+=over
+
+=item suggestAdditionalKernelParams()
+
+Called in order to give the plugin a chance to add any kernel params it
+requires.
+
+In order to do so, the plugin should return a list of additional kernel params
+that it would like to see added.
+
+=cut
sub suggestAdditionalKernelParams
-{ # called by config-demuxer in order to give the plugin a chance to add
- # any kernel params it requires.
- # In order to do so, the plugin should return a list of additional kernel
- # params that it would like to see added.
+{
my $self = shift;
my $makeInitRamFSEngine = shift;
return;
}
+=item suggestAdditionalKernelModules()
+
+Called in order to give the plugin a chance to add any kernel modules it
+requires.
+
+In order to do so, the plugin should return the names of additional kernel
+modules that it would like to see added.
+
+=cut
+
sub suggestAdditionalKernelModules
-{ # called by config-demuxer in order to give the plugin a chance to add
- # any kernel modules it requires.
- # In order to do so, the plugin should return the names of additional kernel
- # modules that it would like to see added.
+{
my $self = shift;
my $makeInitRamFSEngine = shift;
return;
}
+=item copyRequiredFilesIntoInitramfs()
+
+Called in order to give the plugin a chance to copy all required files from the
+vendor-OS into the initramfs.
+
+N.B.: Only files that are indeed required by the initramfs should be copied
+here, i.e. files that are needed *before* the root-fs has been mounted.
+All other files should be taken from the root-fs instead!
+
+=cut
+
sub copyRequiredFilesIntoInitramfs
-{ # called by config-demuxer in order to give the plugin a chance to copy
- # all required files from the vendor-OS into the initramfs.
- # N.B.: Only files that are indeed required by the initramfs should be
- # copied here, i.e. files that are needed *before* the root-fs
- # has been mounted.
- # All other files should be taken from the root-fs instead!
+{
my $self = shift;
my $targetPath = shift;
my $attrs = shift;
@@ -180,12 +287,19 @@ sub copyRequiredFilesIntoInitramfs
return;
}
+=item setupPluginInInitramfs()
+
+Called in order to let the plugin setup all the files it requires in the
+initramfs.
+
+Normally, you don't need to override this method in your own plugin,
+as it is usually enough to override suggestAdditionalKernelParams(),
+suggestAdditionalKernelModules() and maybe copyRequiredFilesIntoInitramfs().
+
+=cut
+
sub setupPluginInInitramfs
-{ # called by config-demuxer in order to let the plugin setup all the files
- # it requires in the initramfs.
- # Normally, you don't need to override this method in your own plugin,
- # as it is usually enough to override suggestAdditionalKernelParams(),
- # suggestAdditionalKernelModules() and maybe copyRequiredFilesIntoInitramfs().
+{
my $self = shift;
my $attrs = shift;
my $makeInitRamFSEngine = shift;
@@ -240,3 +354,13 @@ sub setupPluginInInitramfs
return 1;
}
+
+=back
+
+=head2 Support Interface
+
+=over
+
+=cut
+
+1;
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index fe9efd8f..5db6f9b8 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -19,6 +19,7 @@ use warnings;
our $VERSION = 1.01; # API-version . implementation-version
use File::Basename;
+use File::Path;
use OpenSLX::Basics;
use OpenSLX::OSSetup::Engine;
@@ -71,28 +72,45 @@ sub installPlugin
$osSetupEngine->initialize($self->{'vendor-os-name'}, 'plugin');
$self->{'os-setup-engine'} = $osSetupEngine;
+ # bind mount openslx basepath to /mnt/openslx of vendor-OS:
+ my $basePath = $openslxConfig{'base-path'};
+ my $openslxPathInChroot = "$self->{'vendor-os-path'}/mnt/openslx";
+ mkpath( [ $openslxPathInChroot ] );
+ if (slxsystem("mount -o bind $basePath $openslxPathInChroot")) {
+ croak(
+ _tr(
+ "unable to bind mount '%s' to '%s'! (%s)",
+ $basePath, $openslxPathInChroot, $!
+ )
+ );
+ }
+
+ # now let plugin install itself into vendor-OS
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";
+ 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
+ $chrootedPluginRepoPath, $chrootedPluginTempPath,
+ '/mnt/openslx',
);
}
);
-
- $self->{plugin}->postInstallationPhase($pluginRepoPath, $pluginTempPath);
+
+ if (slxsystem("umount $openslxPathInChroot")) {
+ croak(_tr("unable to umount '%s'! (%s)", $openslxPathInChroot, $!));
+ }
}
$self->_addInstalledPluginToDB();
@@ -119,17 +137,18 @@ sub removePlugin
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";
+ 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);
-
$self->{'os-setup-engine'}->callChrootedFunctionForVendorOS(
sub {
$self->{plugin}->removalPhase(
@@ -137,8 +156,6 @@ sub removePlugin
);
}
);
-
- $self->{plugin}->postRemovalPhase($pluginRepoPath, $pluginTempPath);
}
$self->_removeInstalledPluginFromDB();
diff --git a/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm b/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
index 8f9dd620..69c5c2c7 100644
--- a/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
+++ b/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
@@ -96,89 +96,59 @@ sub getAttrInfo
};
}
-sub preInstallationPhase
-{ # called before chrooting into vendor-OS root, should be used if any files
- # have to be downloaded outside of the chroot (which might be necessary
- # if the required files can't be installed via the meta-packager)
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin should store all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
-
- # in this example plugin, there's no need to do anything here ...
-
- # uncomment the following if you need to copy files
- ## get path of files we need to install
- #my $pluginName = $self->{'name'};
-
- ##my $pluginFilesPath
- # = "$openslxConfig{'base-path'}/lib/plugins/$pluginName/files";
-
- ## copy all needed files now
- #my @files = ("file1", "file2");
- #foreach my $file (@files) {
- # copyFile("$pluginFilesPath/$file", "$pluginRepositoryPath");
- #}
-}
-
sub installationPhase
-{ # called while chrooted to the vendor-OS root, most plugins will do all
- # their installation work here
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to install required files into the vendor-OS.
my $self = shift;
- # name of current os
- # $self->{'os-plugin-engine'}->{'vendor-os-name'}
-
my $pluginRepositoryPath = shift;
- # the repository folder, this time from inside the chroot
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
my $pluginTempPath = shift;
- # the temporary folder, this time from inside the chroot
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $openslxPath = shift;
+ # the openslx base path bind-mounted into the chroot (/mnt/openslx)
# for this example plugin, we simply create two files:
spitFile("$pluginRepositoryPath/right", "(-;\n");
spitFile("$pluginRepositoryPath/left", ";-)\n");
-}
-sub postInstallationPhase
-{ # called after having returned from chrooted environment, should be used
- # to cleanup any leftovers, if any such thing is necessary
- my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
- # in this example plugin, there's no need to do anything here ...
-}
+ # Some plugins have to copy files from their plugin folder into the
+ # vendor-OS. In order to make this possible while chrooted, the host's
+ # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS.
+ # So each plugin could copy some files like this:
+ #
+ # # get our own name:
+ # my $pluginName = $self->{'name'};
+ #
+ # # get our own base path:
+ # my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName";
+ #
+ # # copy all needed files now:
+ # foreach my $file ( qw( file1, file2 ) ) {
+ # copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/");
+ # }
-sub preRemovalPhase
-{ # called before chrooting into vendor-OS root, should be used if any
- # preparations outside of the chroot have to be made before the plugin
- # can be removed
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin has stored all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
+ # name of current os
+ # $self->{'os-plugin-engine'}->{'vendor-os-name'}
+
+ return;
}
sub removalPhase
-{ # called while chrooted to the vendor-OS root, most plugins will do all
- # their uninstallation work here
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to uninstall no longer required files from the vendor-OS.
my $self = shift;
my $pluginRepositoryPath = shift;
- # the repository folder, this time from inside the chroot
+ # the repository folder, relative to the vendor-OS root
my $pluginTempPath = shift;
- # the temporary folder, this time from inside the chroot
-}
+ # the temporary folder, relative to the vendor-OS root
-sub postRemovalPhase
-{ # called after having returned from chrooted environment, should be used
- # to cleanup any leftovers, if any such thing is necessary
- my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
+ return;
}
1;
diff --git a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm
index 4bd83c69..11bef626 100644
--- a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm
+++ b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm
@@ -49,15 +49,10 @@ sub getInfo
}
sub getAttrInfo
-{ # returns a hash-ref with information about all attributes supported
- # by this specific plugin
+{
my $self = shift;
- # This default configuration will be added as attributes to the default
- # system, such that it can be overruled for any specific system by means
- # of slxconfig.
return {
- # attribute 'active' is mandatory for all plugins
'theme::active' => {
applies_to_systems => 1,
applies_to_clients => 0,
@@ -68,7 +63,6 @@ sub getAttrInfo
content_descr => '1 means active - 0 means inactive',
default => '1',
},
- # attribute 'precedence' is mandatory for all plugins
'theme::precedence' => {
applies_to_systems => 1,
applies_to_clients => 0,
diff --git a/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm b/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
index 3d26ef55..406e18e6 100644
--- a/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
+++ b/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
@@ -8,6 +8,9 @@
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
+# vmchooser.pm
+# - allows user to pick from a list of virtual machin images
+# -----------------------------------------------------------------------------
package OpenSLX::OSPlugin::vmchooser;
use strict;
@@ -18,11 +21,6 @@ use base qw(OpenSLX::OSPlugin::Base);
use OpenSLX::Basics;
use OpenSLX::Utils;
-################################################################################
-# if you have any questions regarding the concept of OS-plugins and their
-# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
-# '#openslx' (on freenode).
-################################################################################
sub new
{
my $class = shift;
@@ -40,22 +38,17 @@ sub getInfo
return {
description => unshiftHereDoc(<<' End-of-Here'),
- this plugin will over a list of different, chooseable virtualmachine images
+ allows user to pick from a list of different virtual machine images
End-of-Here
mustRunAfter => [],
};
}
sub getAttrInfo
-{ # returns a hash-ref with information about all attributes supported
- # by this specific plugin
+{
my $self = shift;
- # This default configuration will be added as attributes to the default
- # system, such that it can be overruled for any specific system by means
- # of slxconfig.
return {
- # attribute 'active' is mandatory for all plugins
'vmchooser::active' => {
applies_to_systems => 0,
applies_to_clients => 0,
@@ -66,7 +59,6 @@ sub getAttrInfo
content_descr => '1 means active - 0 means inactive',
default => '1',
},
- # attribute 'precedence' is mandatory for all plugins
'vmchooser::precedence' => {
applies_to_systems => 1,
applies_to_clients => 1,
@@ -80,29 +72,4 @@ sub getAttrInfo
};
}
-sub preInstallationPhase
-{ # called before chrooting into vendor-OS root, should be used if any files
- # have to be downloaded outside of the chroot (which might be necessary
- # if the required files can't be installed via the meta-packager)
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin should store all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
-
- # uncomment the following if you need to copy files
- ## get path of files we need to install
- #my $pluginName = $self->{'name'};
-
- ##my $pluginFilesPath
- # = "$openslxConfig{'base-path'}/lib/plugins/$pluginName/files";
-
- ## copy all needed files now
- #my @files = ("file1", "file2");
- #foreach my $file (@files) {
- # copyFile("$pluginFilesPath/$file", "$pluginRepositoryPath");
- #}
-}
-
1;
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index 91ff3289..af4df603 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -18,6 +18,8 @@ use warnings;
use base qw(OpenSLX::OSPlugin::Base);
+use File::Path;
+
use OpenSLX::Basics;
use OpenSLX::Utils;
@@ -90,27 +92,33 @@ sub getAttrInfo
};
}
-sub preInstallationPhase
-{ # called before chrooting into vendor-OS root, should be used if any files
- # have to be downloaded outside of the chroot (which might be necessary
- # if the required files can't be installed via the meta-packager)
- my $self = shift;
+sub installationPhase
+{
+ my $self = shift;
my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin should store all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
+ my $pluginTempPath = shift;
+ my $openslxPath = shift;
# get path of files we need to install
- my $pluginName = $self->{'name'};
- my $pluginFilesPath
- = "$openslxConfig{'base-path'}/lib/plugins/$pluginName/files";
+ my $pluginFilesPath = "$openslxPath/lib/plugins/$self->{'name'}/files";
# copy all needed files now
- my @files = ("dhcpd.conf", "nat.conf", "nvram.5.0", "runvmware-v2");
+ my @files = qw( dhcpd.conf nat.conf nvram.5.0 runvmware-v2 );
foreach my $file (@files) {
- copyFile("$pluginFilesPath/$file", "$pluginRepositoryPath");
+ copyFile("$pluginFilesPath/$file", $pluginRepositoryPath);
}
}
+sub removalPhase
+{
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ my $pluginTempPath = shift;
+ my $openslxPath = shift;
+
+ rmtree ( [ $pluginRepositoryPath ] );
+
+ return;
+}
+
1;