diff options
author | Oliver Tappe | 2008-01-08 16:50:42 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-01-08 16:50:42 +0100 |
commit | 530745cf3fd1c50be2c89a0f101ea8fc5bac2e9a (patch) | |
tree | c6a7f3c0a2b47296e169bceabbc088ed9b76f136 /os-plugins/OpenSLX/OSPlugin/Engine.pm | |
parent | * minor fix (VERSION) (diff) | |
download | core-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/OpenSLX/OSPlugin/Engine.pm')
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Engine.pm | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index 57850229..bdf259f4 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -64,6 +64,9 @@ sub initialize vlog(1, "plugin path is '$self->{'plugin-path'}'"); $self->{'plugin'} = $self->_loadPlugin(); + return if !$self->{'plugin'}; + + return 1; } sub installPlugin @@ -98,6 +101,10 @@ sub installPlugin ); $self->{plugin}->postInstallationPhase($pluginRepoPath, $pluginTempPath); + + $self->_addInstalledPluginToDB(); + + return 1; } sub getPlugin @@ -119,6 +126,51 @@ sub _loadPlugin my $plugin = instantiateClass( $pluginModule, { pathToClass => $self->{'plugin-path'} } ); + return if !$plugin; + $plugin->initialize($self); + return $plugin; } + +sub _addInstalledPluginToDB +{ + 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'} + ); + } + $openslxDB->addInstalledPlugin($vendorOS->{id}, $self->{'plugin-name'}); + $openslxDB->disconnect(); + + return 1; +} + +sub _removeInstalledPluginFromDB +{ + 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'} + ); + } + $openslxDB->removeInstalledPlugin($vendorOS->{id}, $self->{'plugin-name'}); + $openslxDB->disconnect(); + + return 1; +} + +1; |