summaryrefslogtreecommitdiffstats
path: root/os-plugins/OpenSLX
diff options
context:
space:
mode:
authorOliver Tappe2008-05-26 21:22:00 +0200
committerOliver Tappe2008-05-26 21:22:00 +0200
commitb943b09340c3e3c59f83823946ceeb3e453b3e52 (patch)
treecfbb91e9b11a909b3ffc785cb9c18fc68a06d1fc /os-plugins/OpenSLX
parentFixed non-working installation & deinstallation of plugins into/from the '<<<... (diff)
downloadcore-b943b09340c3e3c59f83823946ceeb3e453b3e52.tar.gz
core-b943b09340c3e3c59f83823946ceeb3e453b3e52.tar.xz
core-b943b09340c3e3c59f83823946ceeb3e453b3e52.zip
* reworked plugin-API concerning the way the parameters are passed into
installationPhase() and removalPhase() - now we use a hash as the amount of parameters has become too large * adjusted all plugins to these API change * now not only the openslx base path, but the openslx config path is bind mounted into the vendor-OS chroot, such that plugins can check the available local configuration extensions git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1803 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/OpenSLX')
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Base.pm68
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm68
2 files changed, 100 insertions, 36 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm
index a07ec125..5c8f4e6c 100644
--- a/os-plugins/OpenSLX/OSPlugin/Base.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Base.pm
@@ -225,22 +225,47 @@ 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.
+N.B.: This method is invoked while chrooted into the vendor-OS root.
+
+The hash-ref given in B<$info> contains vital information for the installation
+process:
+
+=over
+
+=item C<plugin-repo-path>
+
+The folder where the stage1-plugin should store all files required by the
+corresponding stage3 runlevel script.
+
+=item C<plugin-temp-path>
+
+A temporary playground that will be cleaned up automatically.
+
+=item C<openslx-base-path>
+
+In order to make the OpenSLX files from the host available, the OpenSLX base
+folder (normally /opt/openslx) will be mounted into the chroot.
+So if you have to copy any files from the host, fetch them from this path.
+
+=item C<openslx-config-path>
+
+In order to make the OpenSLX config files from the host available, the OpenSLX
+config folder (normally /etc/opt/openslx) will be mounted into the chroot.
+So if you have to copy any config files from the host, fetch them from this
+path.
+
+=item C<plugin-attrs>
+
+Contains the attributes in effect for the installation of this plugin.
+
+=back
=cut
sub installationPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, relative to the vendor-OS root
- my $pluginTempPath = shift;
- # the temporary folder, relative to the vendor-OS root
- my $openslxPath = shift;
- # the openslx base path bind-mounted into the chroot (/mnt/openslx)
+ my $info = shift;
return;
}
@@ -255,17 +280,28 @@ the vendor-OS' meta packager.
N.B.: This method is invoked while chrooted into the vendor-OS root.
+The hash-ref given in B<$info> contains vital information for the installation
+process:
+
+=over
+
+=item C<plugin-repo-path>
+
+The folder where the stage1-plugin should store all files required by the
+corresponding stage3 runlevel script.
+
+=item C<plugin-temp-path>
+
+A temporary playground that will be cleaned up automatically.
+
+=back
+
=cut
sub removalPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, relative to the vendor-OS root
- my $pluginTempPath = shift;
- # the temporary folder, relative to the vendor-OS root
- my $openslxPath = shift;
- # the openslx base path bind-mounted into the chroot (/mnt/openslx)
+ my $info = shift;
return;
}
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index 8527e827..6db265e9 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -94,7 +94,8 @@ sub initialize
= "/tmp/slx-plugin/$self->{'plugin-name'}";
$self->{'plugin-temp-path'}
= "$self->{'vendor-os-path'}/$self->{'chrooted-plugin-temp-path'}";
- $self->{'chrooted-openslx-base-path'} = '/mnt/openslx';
+ $self->{'chrooted-openslx-base-path'} = '/mnt/opt/openslx';
+ $self->{'chrooted-openslx-config-path'} = '/mnt/etc/opt/openslx';
# check and store given attribute set
my $knownAttrs = $self->{plugin}->getAttrInfo();
@@ -168,12 +169,18 @@ sub installPlugin
$self->_callChrootedFunctionForPlugin(
sub {
# invoke plugin and let it install itself into vendor-OS
- $self->{plugin}->installationPhase(
- $self->{'chrooted-plugin-repo-path'},
- $self->{'chrooted-plugin-temp-path'},
- $self->{'chrooted-openslx-base-path'},
- $self->{'plugin-attrs'},
- );
+ $self->{plugin}->installationPhase( {
+ 'plugin-repo-path'
+ => $self->{'chrooted-plugin-repo-path'},
+ 'plugin-temp-path'
+ => $self->{'chrooted-plugin-temp-path'},
+ 'openslx-base-path'
+ => $self->{'chrooted-openslx-base-path'},
+ 'openslx-config-path'
+ => $self->{'chrooted-openslx-config-path'},
+ 'plugin-attrs'
+ => $self->{'plugin-attrs'},
+ } );
# serialize possibly changed attributes (executed inside chroot)
store $self->{'plugin-attrs'}, $chrootedSerializedAttrsFile;
@@ -208,11 +215,18 @@ sub removePlugin
$self->_callChrootedFunctionForPlugin(
sub {
- $self->{plugin}->removalPhase(
- $self->{'chrooted-plugin-repo-path'},
- $self->{'chrooted-plugin-temp-path'},
- $self->{'chrooted-openslx-base-path'},
- );
+ $self->{plugin}->removalPhase( {
+ 'plugin-repo-path'
+ => $self->{'chrooted-plugin-repo-path'},
+ 'plugin-temp-path'
+ => $self->{'chrooted-plugin-temp-path'},
+ 'openslx-base-path'
+ => $self->{'chrooted-openslx-base-path'},
+ 'openslx-config-path'
+ => $self->{'chrooted-openslx-config-path'},
+ 'plugin-attrs'
+ => $self->{'plugin-attrs'},
+ } );
}
);
@@ -550,25 +564,39 @@ sub _callChrootedFunctionForPlugin
my $function = shift;
# 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);
+ my $basePath = $openslxConfig{'base-path'};
+ my $basePathInChroot = "$self->{'vendor-os-path'}/mnt/opt/openslx";
+ mkpath($basePathInChroot);
+ my $configPath = $openslxConfig{'config-path'};
+ my $configPathInChroot = "$self->{'vendor-os-path'}/mnt/etc/opt/openslx";
+ mkpath($configPathInChroot);
my $pluginSession = OpenSLX::ScopedResource->new({
name => 'osplugin::session',
acquire => sub {
- # bind mount openslx base path into vendor-OS
- slxsystem("mount -o bind -o ro $basePath $openslxPathInChroot") == 0
+ # bind mount openslx base and config paths into vendor-OS
+ slxsystem("mount -o bind -o ro $basePath $basePathInChroot") == 0
or die _tr(
"unable to bind mount '%s' to '%s'! (%s)",
- $basePath, $openslxPathInChroot, $!
+ $basePath, $basePathInChroot, $!
+ );
+ slxsystem(
+ "mount -o bind -o ro $configPath $configPathInChroot"
+ ) == 0
+ or die _tr(
+ "unable to bind mount '%s' to '%s'! (%s)",
+ $configPath, $configPathInChroot, $!
);
1
},
release => sub {
- slxsystem("umount $openslxPathInChroot") == 0
+ slxsystem("umount $basePathInChroot") == 0
+ or die _tr(
+ "unable to umount '%s'! (%s)", $basePathInChroot, $!
+ );
+ slxsystem("umount $configPathInChroot") == 0
or die _tr(
- "unable to umount '%s'! (%s)", $openslxPathInChroot, $!
+ "unable to umount '%s'! (%s)", $configPathInChroot, $!
);
1
},