diff options
| author | Oliver Tappe | 2008-05-22 22:01:34 +0200 |
|---|---|---|
| committer | Oliver Tappe | 2008-05-22 22:01:34 +0200 |
| commit | 2a614b1103699d60e7e2999030d64e2adc9a6955 (patch) | |
| tree | 0e0ffd2962e5835f08e3749d258cd36d9e3a7a79 /os-plugins/OpenSLX | |
| parent | * supress lib error while giving vmware its own font config (diff) | |
| download | core-2a614b1103699d60e7e2999030d64e2adc9a6955.tar.gz core-2a614b1103699d60e7e2999030d64e2adc9a6955.tar.xz core-2a614b1103699d60e7e2999030d64e2adc9a6955.zip | |
* attributes set via slxconfig are now being checked not only against the respective
regex, but the corresponding plugin is being invoked to do a check of its own, too
(where it has the chance to look at the vendor-OS attributes and determine the
possible stage3-values from their state).
* listing a vendor-OS in verbose mode now shows the vendor-OS attributes (stage1 &
stage3), too
* used Clone::clone instead of Storable::dclone since the latter is not capable of
cloning compiled regexes
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1783 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/OpenSLX')
| -rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Base.pm | 26 | ||||
| -rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Engine.pm | 40 | ||||
| -rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Roster.pm | 6 |
3 files changed, 57 insertions, 15 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm index b89f73fa..8c314ff5 100644 --- a/os-plugins/OpenSLX/OSPlugin/Base.pm +++ b/os-plugins/OpenSLX/OSPlugin/Base.pm @@ -182,29 +182,33 @@ sub getDefaultAttrsForVendorOS return $self->getAttrInfo(); } -=item checkValueForKey() +=item checkStage3AttrValues() -Checks if the given value is allowed (and makes sense) for the given key. -If the value is ok, this method returns 1 - if not, it dies with an appropriate -message. +Checks if the stage3 values given in B<$stage3Attrs> are allowed and makes +sense. -Plugins may override this implementation to do checks that for instance look -at the vendor-OS (stage1-)attributes. +If all values are ok, this method returns 1 - if not, it dies with an appropriate message. + +Plugins may override this implementation to do checks that for instance look +at the stage1 vendor-OS-attributes given in B<$vendorOSAttrs>. + +N.B.: this method is called while being chrooted into the vendor-OS, so it + may invoke all distro methods that expect to be run in this environment, + too =cut -sub checkValueForKey +sub checkStage3AttrValues { - my $self = shift; - my $key = shift; - my $value = shift; + my $self = shift; + my $stage3Attrs = shift; + my $vendorOSAttrs = shift; # this default implementation does no further checks (thus relying on the # attributte regex check that is done in the AttributeRoster) return 1; } - =back =head2 Vendor-OS Interface diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index 0672aa5e..ada0af79 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -126,6 +126,7 @@ sub initialize ? $dbAttrs->{$attrName} : $defaultAttrs->{$attrName}->{default}; } + $self->{'vendorOS-attrs'} = $dbAttrs; } return 1; @@ -377,7 +378,6 @@ sub getInstallablePackagesForSelection ); } - =item installPackages($packages) Installs the given packages into the vendor-OS. @@ -447,6 +447,44 @@ sub removePackages =back +=head2 Driver Interface + +The following methods are invoked by the slxos-plugin script in order to +install/remove a plugin into/from a vendor-OS: + +=over + +=item checkStage3AttrValues() + +Checks if the stage3 values given in B<$stage3Attrs> are allowed and make sense. + +If all values are ok, this method returns 1 - if not, it dies with an +appropriate message. + +This method chroots into the vendor-OS and then asks the plugin itself to check +the attributes. + +=cut + +sub checkStage3AttrValues +{ + my $self = shift; + my $stage3Attrs = shift; + + $self->_callChrootedFunctionForPlugin( + sub { + # let plugin check by itself + $self->{plugin}->checkStage3AttrValues( + $stage3Attrs, $self->{'vendorOS-attrs'} + ); + } + ); + + return 1; +} + +=back + =cut sub _loadPlugin diff --git a/os-plugins/OpenSLX/OSPlugin/Roster.pm b/os-plugins/OpenSLX/OSPlugin/Roster.pm index 023abb4c..7bfed044 100644 --- a/os-plugins/OpenSLX/OSPlugin/Roster.pm +++ b/os-plugins/OpenSLX/OSPlugin/Roster.pm @@ -17,7 +17,7 @@ use strict; use warnings; use OpenSLX::Basics; -use Storable qw(dclone); +use Clone qw(clone); my %plugins; @@ -56,7 +56,7 @@ sub getPlugin my $plugin = $plugins{$pluginName}; return if !$plugin; - return dclone($plugin); + return clone($plugin); } =item C<getPluginAttrInfo()> @@ -179,7 +179,7 @@ sub _addAttributesToHash my $pluginAttrInfo = $plugin->getAttrInfo(); foreach my $attr (keys %$pluginAttrInfo) { next if !$testFunc->($pluginAttrInfo->{$attr}); - $attrInfo->{$attr} = dclone($pluginAttrInfo->{$attr}); + $attrInfo->{$attr} = clone($pluginAttrInfo->{$attr}); } } return 1; |
