summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins
diff options
context:
space:
mode:
authorOliver Tappe2008-01-08 16:50:42 +0100
committerOliver Tappe2008-01-08 16:50:42 +0100
commit530745cf3fd1c50be2c89a0f101ea8fc5bac2e9a (patch)
treec6a7f3c0a2b47296e169bceabbc088ed9b76f136 /os-plugins/plugins
parent* minor fix (VERSION) (diff)
downloadcore-530745cf3fd1c50be2c89a0f101ea8fc5bac2e9a.tar.gz
core-530745cf3fd1c50be2c89a0f101ea8fc5bac2e9a.tar.xz
core-530745cf3fd1c50be2c89a0f101ea8fc5bac2e9a.zip
* implemented automatic synchronization of new/changed attributes (either
from core or plugins) into the default system * reworked the way plugins pass out their attribute info git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1451 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins')
-rw-r--r--os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm111
-rw-r--r--os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm87
2 files changed, 86 insertions, 112 deletions
diff --git a/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm b/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm
index 9ade866a..ec5dd03d 100644
--- a/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm
+++ b/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm
@@ -16,7 +16,7 @@ package OpenSLX::OSPlugin::Example;
use strict;
use warnings;
-our $VERSION = 1.01; # API-version . implementation-version
+use base qw(OpenSLX::OSPlugin::Base);
use OpenSLX::Basics;
use OpenSLX::Utils;
@@ -26,8 +26,6 @@ use OpenSLX::Utils;
# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
# '#openslx' (on freenode).
################################################################################
-### interface methods
-################################################################################
sub new
{
my $class = shift;
@@ -37,27 +35,63 @@ sub new
return bless $self, $class;
}
-sub initialize
+sub getInfo
{
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;
-
- # Any other static initialization necessary for a plugin should be done
- # here, more often than not, this will involve a configurational hash
- # representing the default settings for this plugin.
- # At a later stage, the user will be able to change plugin-specific settings
- # (on a per-system/client basis) via slxconfig, such that the actual
- # configuration will be stored in the DB.
- # Currently, though, you have to change the settings here:
- $self->{config} = {
- 'active' => 1, # set to 0 in order to deactivate
- 'precedence' => 10, # runlevel precedence
- 'preferred_side' => 'left', # just a silly example
- }
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ just an exemplary plugin that prints a smiley when the client boots
+ 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 & client
+ # by means of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'example::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'Example'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ # attribute 'precedence' is mandatory for all plugins
+ 'example::precedence' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ the execution precedence of the 'Example' plugin
+ End-of-Here
+ content_regex => qr{^\d\d$},
+ content_descr => 'allowed range is from 01-99',
+ default => 50,
+ },
+
+ # plugin specific attributes start here ...
+ 'example::preferred_side' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ determines to which side you have to tilt your head in order
+ to read the smiley
+ End-of-Here
+ content_regex => qr{^(left|right)$},
+ content_descr => q{'left' will print ';-)' - 'right' will print '(-;'},
+ default => 'left',
+ },
+ };
}
sub preInstallationPhase
@@ -98,25 +132,34 @@ sub postInstallationPhase
# in this example plugin, there's no need to do anything here ...
}
-sub getConfig
-{ # called from the config-demuxer in order ot access the configurational
- # hash, which will then be written to a file (in this case:
- # /opt/openslx/plugin-conf/Example.conf), that will be transported to each
- # client as part of the conf-TGZ.
- my $self = shift;
-
- return $self->{config};
-}
-
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
}
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
+ my $pluginTempPath = shift;
+ # the temporary folder, this time from inside the chroot
}
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;
}
+1;
diff --git a/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm b/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm
index 4167ffdd..6fddf78c 100644
--- a/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm
+++ b/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm
@@ -16,7 +16,7 @@ package OpenSLX::OSPlugin::VMware;
use strict;
use warnings;
-our $VERSION = 1.01; # API-version . implementation-version
+use base qw(OpenSLX::OSPlugin::Base);
use OpenSLX::Basics;
use OpenSLX::Utils;
@@ -37,85 +37,16 @@ sub new
return bless $self, $class;
}
-sub initialize
+sub getInfo
{
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;
-
- # Any other static initialization necessary for a plugin should be done
- # here, more often than not, this will involve a configurational hash
- # representing the default settings for this plugin.
- # At a later stage, the user will be able to change plugin-specific settings
- # (on a per-system/client basis) via slxconfig, such that the actual
- # configuration will be stored in the DB.
- # Currently, though, you have to change the settings here:
- $self->{config} = {
- 'active' => 0, # set to 0 in order to deactivate
- 'precedence' => 10, # runlevel precedence
- }
-}
-
-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 ...
-}
-
-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
- my $pluginTempPath = shift;
- # the temporary folder, this time from inside the chroot
-
- # 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 ...
-}
-
-sub getConfig
-{ # called from the config-demuxer in order ot access the configurational
- # hash, which will then be written to a file (in this case:
- # /opt/openslx/plugin-conf/VMware.conf), that will be transported to each
- # client as part of the conf-TGZ.
- my $self = shift;
-
- return $self->{config};
-}
-
-sub preRemovalPhase
-{
-}
-
-sub removalPhase
-{
-}
-
-sub postRemovalPhase
-{
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!! descriptive text missing here !!!
+ End-of-Here
+ mustRunAfter => [],
+ };
}
+1;